How to write VBA macro to read a manually updated cell G3 content e.g. B7:T60 and then select a range based on this + sort

ricohflex

New Member
Joined
Mar 18, 2016
Messages
6
I an unable to find a book or Youtube video to help me write a macro.

I have a large worksheet, which I update and add more rows of data each day.
I manually update the range of the most recently updated data that I wish to sort, into a cell G3 at the top above the data.

For example today I update new info and the range I wish to sort is B7:T60
Two days later I may update the content in the G3 cell to B7:T67
Fourdays later I may update the content in G3 cell to B7:T75

I want to write a VBA macro to read that cell G3 and the select the Range based on the content.
Then do a Sort (no header row) on column H (ascending) and column L (descending).

Thanks for any help.
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Will the range always start at B7?
 
Upvote 0
Ok, how about
VBA Code:
Sub ricohflex()
   Range(Range("G3").Value).Sort Range("H7"), xlAscending, Range("L7"), , xlDescending, Header:=xlNo
End Sub
 
Upvote 0
Solution
You're welcome & thanks for the feedback.
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

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