SELECT ACTIVE RANGE

CJ

Board Regular
Joined
Feb 22, 2002
Messages
77
Hi,
I'm trying to select an active range, after importing a text file,
it will always be a different range
I've tryed adapting code found through a search.

LastRow = Range("A1:G65536").End(xlUp).Row
Range("A1:G65536").Select.Range ("A1:G65536" & LastRow)

It's stopped with a debugger 424 error

Any idea's

Thanks
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Perhaps, something like this:

Code:
Sub test()
Dim lastRow As Long
lastRow = Range("A65536").End(xlUp).Row
Range("A1:G" & lastRow).Select
End Sub
 
Upvote 0
I think this is the correct syntax fir you want.
Code:
LastRow = Range("G65536").End(xlUp).Row 
Range ("A1:G" & LastRow)
By the way why do you want to select the range? You don't need to select /activate ranges/worksheets etc to work with them.
 
Upvote 0
SOLVED.........

Hi, Norrie , HOTPEPPER

Thanks for yor help, both worked fine.

PS Norie thanks you have helped me twice now Cheers, I'm 2/3 of the way
to acheiving my Goal fully automating a long and boring process picking a
text file from a server and producing numerous Pivot Table reports
THANKS
 
Upvote 0

Forum statistics

Threads
1,207,094
Messages
6,076,549
Members
446,212
Latest member
KJAYPAL200

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