Macro to define current active cell as part of a range after

Cosmos75

Active Member
Joined
Feb 28, 2002
Messages
359
I am trying to write a macro to select I particular range that is below two lists. So the First part of the Macro is this:

Range("A1").Select

‘Bring me to end of 1st list
Selection.End(xlDown).Select

‘Bring me to start of 2nd list
Selection.End(xlDown).Select

‘Bring me to end of 2nd list
Selection.End(xlDown).Select

‘Bring me to start of 3rd list
Selection.End(xlDown).Select

‘Select Upper-Left Corner of List
ActiveCell.Select

??? – How can I name the active cell as UpperLeft?

UpperLeft = ActiveCell???

Range("UpperLeft", Range("B65536").End(xlUp).Address).Select

I don’t know how to get that ??? part? Is it Dim UpperLeft As Range?String?Cell?
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Try this code:

UpperLeft = ActiveCell.Address
Range(UpperLeft, Range("B65536").End(xlUp).Address).Select

Hope it helps.
Kind regards, Al.
 
Upvote 0
Dim UpperLeft As Range
Set UpperLeft = ActiveCell
Range(UpperLeft, [B65536].End(xlUp)).Select

Your whole code could be re-written as follows (to avoid all that selecting) :-

Dim UpperLeft As Range
Set UpperLeft = [A1].End(xlDown).End(xlDown).End(xlDown).End(xlDown)
Range(UpperLeft, [B65536].End(xlUp)).Select
 
Upvote 0

Forum statistics

Threads
1,214,646
Messages
6,120,717
Members
448,985
Latest member
chocbudda

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