I always seem to struggle with what I think should be simple references.
I am in a workbook called "Test".
I also have open a workbook called "Operations Report" which has a sheet called "SoCal".
I have a macro command in Test that I want to use to copy a range from SoCal. I am trying the following but get an error:
Workbooks("Operations Report").Worksheets("SoCal").Range(Cells(1, 1), Cells(1, 80)).Copy
Can anyone help me on what I am doing wrong?
Also, if in the macro, I set a variable f="SoCal" then how can I use this so that rather than hard-coding Worksheets("SoCal"), I can use something like Worksheets(f)?
Thanks,
MikeG
I am in a workbook called "Test".
I also have open a workbook called "Operations Report" which has a sheet called "SoCal".
I have a macro command in Test that I want to use to copy a range from SoCal. I am trying the following but get an error:
Workbooks("Operations Report").Worksheets("SoCal").Range(Cells(1, 1), Cells(1, 80)).Copy
Can anyone help me on what I am doing wrong?
Also, if in the macro, I set a variable f="SoCal" then how can I use this so that rather than hard-coding Worksheets("SoCal"), I can use something like Worksheets(f)?
Thanks,
MikeG