Fix loop for cell reference totally stuck

  • I am trying to look through worksheets copying one area to the sheet and then onto the next sheet.
    My problem is that the copying cell references are all on a table on sheet1.


    Tried to put this together, my excel habits of nesting may be getting in the way. Can I receive assistance?


    Code
    For x = 3 To Sheets.Count 
            Worksheets("sheet" & x).Activate 
            Range(Sheet1.Range(.Cells((42 + x - 3), 6).Value, .Cells((42 + x - 3), 7).Value)).Copy 
            Sheets(CStr(rSheets(x, 1))).Cells(3, CStr(rSheets(x, 2))).PasteSpecial xlValues 
            Sheets(CStr(rSheets(x, 1))).Cells(3, CStr(rSheets(x, 2))).PasteSpecial xlPasteColumnWidths 
        Next x
  • Re: Fix loop for cell reference totally stuck


    Working with Tables sometimes require different methods. Can you supply a working sample of your Workbook?

  • Re: Fix loop for cell reference totally stuck


    What sheet are Range and.Cells meant to refer to here?

    Code
    Range(Sheet1.Range(.Cells((42 + x - 3), 6).Value, .Cells((42 + x - 3), 7).Value)).Copy


    What do you actually have on Sheet1?

    Boo!:yikes:

  • Re: Fix loop for cell reference totally stuck


    I uploaded the file. I have names on all of the sheets, so decided to just call them by Sheet1, 2, etc. You are allowed to do that, right?

  • Re: Fix loop for cell reference totally stuck


    Quote from tjrt;773927

    Working with Tables sometimes require different methods. Can you supply a working sample of your Workbook?


    I have, thank you.

  • Re: Fix loop for cell reference totally stuck


    Sheet1 is actually named USD.
    It has a table on it (each column is a calculated reference to a Cell on another Sheet)
    for sheets 3 to 15, I have to copy four columns from sheets 3 to 15, and paste to other columns on sheets 3 to 15.
    The references of what columns to copy and where to paste are on this table on Sheet1.
    Doing this is the crux of the problem.
    Ken


    Table on Sheet1.


    [TABLE="width: 422"]

    [tr]


    [td][/td]


    [td][/td]


    [td][/td]


    [td][/td]


    [td][/td]


    [td][/td]


    [/tr]


    [tr]


    [td]

    Sheet #

    [/td]


    [td]

    Sheet

    [/td]


    [td][/td]


    [TD="colspan: 2"]Dependent of this sheet[/TD]

    [td][/td]


    [/tr]


    [tr]


    [td][/td]


    [td]

    NAME

    [/td]


    [td]

    Copy to

    [/td]


    [TD="colspan: 2"]Copy ranges on sheets[/TD]

    [td][/td]


    [/tr]


    [tr]


    [td][/td]


    [td][/td]


    [td]

    on sheets

    [/td]


    [td][/td]


    [td][/td]


    [td][/td]


    [/tr]


    [tr]


    [td]

    3

    [/td]


    [td]

    ARS

    [/td]


    [td]

    PX

    [/td]


    [td]

    PT1

    [/td]


    [td]

    PW18

    [/td]


    [td][/td]


    [/tr]


    [tr]


    [td]

    4

    [/td]


    [td]

    AUD

    [/td]


    [td]

    PX

    [/td]


    [td]

    PT1

    [/td]


    [td]

    PW18

    [/td]


    [td][/td]


    [/tr]


    [tr]


    [td]

    5

    [/td]


    [td]

    BRL

    [/td]


    [td]

    QA

    [/td]


    [td]

    PW1

    [/td]


    [td]

    PZ18

    [/td]


    [td][/td]


    [/tr]


    [tr]


    [td]

    6

    [/td]


    [td]

    CAD

    [/td]


    [td]

    PZ

    [/td]


    [td]

    PV1

    [/td]


    [td]

    PY18

    [/td]


    [td][/td]


    [/tr]


    [tr]


    [td]

    7

    [/td]


    [td]

    CNY

    [/td]


    [td]

    PU

    [/td]


    [td]

    PQ1

    [/td]


    [td]

    PT18

    [/td]


    [td][/td]


    [/tr]


    [tr]


    [td]

    8

    [/td]


    [td]

    EUR

    [/td]


    [td]

    PU

    [/td]


    [td]

    PQ1

    [/td]


    [td]

    PT18

    [/td]


    [td][/td]


    [/tr]


    [tr]


    [td]

    9

    [/td]


    [td]

    JPY

    [/td]


    [td]

    PU

    [/td]


    [td]

    PQ1

    [/td]


    [td]

    PT18

    [/td]


    [td][/td]


    [/tr]


    [tr]


    [td]

    10

    [/td]


    [td]

    MXN

    [/td]


    [td]

    PU

    [/td]


    [td]

    PQ1

    [/td]


    [td]

    PT18

    [/td]


    [td][/td]


    [/tr]


    [tr]


    [td]

    11

    [/td]


    [td]

    NZD

    [/td]


    [td]

    PU

    [/td]


    [td]

    PQ1

    [/td]


    [td]

    PT18

    [/td]


    [td][/td]


    [/tr]


    [tr]


    [td]

    12

    [/td]


    [td]

    RUB

    [/td]


    [td]

    PU

    [/td]


    [td]

    PQ1

    [/td]


    [td]

    PT18

    [/td]


    [td][/td]


    [/tr]


    [tr]


    [td]

    13

    [/td]


    [td]

    SEK

    [/td]


    [td]

    PU

    [/td]


    [td]

    PQ1

    [/td]


    [td]

    PT18

    [/td]


    [td][/td]


    [/tr]


    [tr]


    [td]

    14

    [/td]


    [td]

    ZAR

    [/td]


    [td]

    QA

    [/td]


    [td]

    PW1

    [/td]


    [td]

    PZ18

    [/td]


    [td][/td]


    [/tr]


    [tr]


    [td]

    15

    [/td]


    [td]

    INR

    [/td]


    [td]

    PU

    [/td]


    [td]

    PQ1

    [/td]


    [td]

    PT18

    [/td]


    [td][/td]


    [/tr]


    [/TABLE]

  • Re: Fix loop for cell reference totally stuck


    Can you take another look?


    latest effort for this..




    What it does is copy from current sheet onto the other sheets.
    That is not what I want.
    I want to copy from sheet 3 (an area per the chart on sheet 1) to an adjacent area on sheet 3,
    then do it again, from sheet 4, 5, 6 etc. through 15.
    Cannot figure, and already uploaded worksheet.
    Ken

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!