Help with a Macro

Dan Wilson

Well-known Member
Joined
Feb 5, 2006
Messages
507
Office Version
  1. 365
Platform
  1. Windows
Good day. I am running Excel out of Office 365 (updated) and Windows 10 Home (updated). I have a worksheet that contains Columns A thru P and almost 3,000 Rows. There are eight macros to sort the data different ways. Each of the Macros has a one-word title to identify it. For example - Numb equals a sort by number, Year equals a sort by year. Is there some code that will allow me to place the name of the Macro in cell Q1 to identify the way the data is sorted when the Macro is done? Cell Q! would then be changed by each Macro as it runs. The entire worksheet uses Freeze Top Row. Thank you for any response.
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Why not just add a line to the end of each macro code telling with the name of the macro in it, i.e.
at the end of your "Numb" macro:
VBA Code:
Range("Q1")="Numb"
at the end of your "Year" macro:
VBA Code:
Range("Q1")="Year"
etc
 
Upvote 0
Solution
In Numb macro at the end add line
VBA Code:
Range("Q1")="Sorted by number"

In Year macro at the end add line
VBA Code:
Range("Q1")="Sorted by year"
 
Upvote 0
Why not just add a line to the end of each macro code telling with the name of the macro in it, i.e.
at the end of your "Numb" macro:
VBA Code:
Range("Q1")="Numb"
at the end of your "Year" macro:
VBA Code:
Range("Q1")="Year"
etc
Good day Joe4 and thank you for responding. I had to do a bit of experimenting to get it right, but everything is working as wanted. The more I use Excel, the more I love it!
In Numb macro at the end add line
VBA Code:
Range("Q1")="Sorted by number"

In Year macro at the end add line
VBA Code:
Range("Q1")="Sorted by year"
Good day kvsrinivasamurthy and thank you for responding. Your response was the same as Joe4 except for more lengthy labels. I had to some expermenting to get it to work, but All is working as wanted.
 
Upvote 0
You are welcome,
Glad I was able to help.
 
Upvote 0

Forum statistics

Threads
1,215,084
Messages
6,123,029
Members
449,092
Latest member
ikke

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