Selecting diferent ranges

nmspt

New Member
Joined
Mar 28, 2002
Messages
2
Hi,

I need help on a macro that selects and copies a range of cells that go from A3 to H?? (the final row depends on the number of entries)

I have the reference to the H?? cell in "K7" , but I can't make a macro to reference that address, I'm only getting the K7 reference. How do I make the macro select the address that I have in K7? Is it possible or do I have to approach the problem from another angle?

Thanks,
Nelson
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Define k7 as a variable in your macro like this:

Sub select_range()
selectend = Range("K7").Value
Range("A3:" & selectend).Select
End Sub
This message was edited by robfo0 on 2002-04-08 16:54
 
Upvote 0
Just wondering why you place the last row into K7? How about eliminating that step and using the line of code such as
Range([A3], [H65536].End(xlUp)).Select

Unless there's something else going on with your spreadsheet, this might be a way to go.
 
Upvote 0

Forum statistics

Threads
1,213,510
Messages
6,114,048
Members
448,543
Latest member
MartinLarkin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top