Stepping through a current macro I'm working on I noticed that the sheet names (in an IF block) is case sensitive. What would be the best way to get around this if the workbook comes from various sources and the sheet names can be in various cases like DERIVATIVES or Derivatives or derivatives or even dERIVATIVES (not that this one is likely!)
I have modified it as below, but is it necessary to add all the other variations using OR's, or is there a easier/shorter way or testing this?
TX
Code: Select all
If sh.Name = "DERIVATIVES" Or sh.Name = "BROKERAGE" Or _
sh.Name = "Derivatives" Or sh.Name = "Brokerage" Then
Range(rStart, rEnd).EntireRow.Copy
Workbooks(sNewWBName).Activate
Worksheets(sh.Name).Activate
Range("A4").PasteSpecial xlPasteColumnWidths
Range("A4").PasteSpecial
Range("A4").Select
Else