Select Sheet Name and Copy just the name for macro use

yorkbay

New Member
Joined
Feb 7, 2021
Messages
18
Office Version
  1. 2013
Platform
  1. Windows
Is there a way to capture a sheet 'name'. I have a macro that compares the changes made on 2 sheets but the sheet names will be unique as they are generated by a macro that runs a report. The sheet names are saved by today's date and time. My macro is as follows to compare the 2 and find the changes:

Dim rngCell As Range
For Each rngCell In Worksheets("Sheet2").UsedRange
If Not rngCell = Worksheets("Sheet1").Cells(rngCell.Row, rngCell.Column) Then
rngCell.Interior.Color = vbYellow
End If
Next rngCell

The problem is, my macro is set up with sheet2 and sheet1 just while I tested how to do this, BUT I'm now stuck in that I need the user to tell me which 2 reports to compare since any user can run a report while they are working in the file hence multiple named reports could potentially exist at any given time. I want the admin to be able to specify the 2 sheets i.e. the 03-03-2021 13:13:05 sheet and perhaps a 03:05:2021 09:15:08 report. I was thinking a prompt to allow the user to select the sheet tab and then have the name copied into my macro etc but I'm stuck since report names are ever changing etc.. Thoughts?
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Please supply the cross post links, as per board rules. This is not the 1st time you have cross posted without links.

Cross-posting (posting the same question in more than one forum) is not against our rules, but the method of doing so is covered by #13 of the Forum Rules.

Be sure to follow & read the link at the end of the rule too!

If you do cross-post in the future and also provide links, then there shouldn’t be a problem.
 
Upvote 0

Forum statistics

Threads
1,214,965
Messages
6,122,495
Members
449,088
Latest member
Melvetica

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