views:

947

answers:

3

I'm looking for a macro which can be run to select a consistent range of cells so that I can easily copy them to another spreadsheet. The range would be F3:BJ3.

Thanks for your help.

nlh

+2  A: 

This should do the trick:

Public Sub selectCells()
    Range("F3:BJ3").Select
End Sub

edit: for that matter, you can use the following to actually perform the 'copy' command for you as well:

Public Sub selectCellsAndCopy()
    Range("F3:BJ3").Select
    Selection.Copy
End Sub
e.James
A: 

Thanks very much...works just like I wanted it to!

Why don't you accept his answer?
Roberto Liffredo
I think he may be having account problems. The nlh that posted this response is not the same nlh that asked the question (rep scores are different). Still, I was wondering the same thing :)
e.James
A: 

What if the range of cells is stored in a variable? E.g. - here if "F3:BJ3" is stored in a variable, how can we pass that variable to range? In my case, refer the following -

tmp_str = "B" & Setup_StartRow & ":B" & Setup_LastRow Range(tmp_str).Select

If I do this, I am getting a Run-Time error - 1004. Please advise how to address this issue!

Joyc