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?
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?