Modify A Macro

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am using this cose:

For Each sh In SheetList

i = i + 1
If Application.Range("SheetNames").Cells(i, 1).Value <> "" Then
With sh
LastRow = .Range("a8").End(xlDown).Row
LastCol = .Range("a8").End(xlToRight).Column
Set RngToName = .Range("a8", .Cells(LastRow, LastCol))
RngToName.Name = Application.Range("SheetNames").Cells(i,
1).Value
End With
End If
Next sh

I would like to set the range of the to A5:P1000

Is there any easy way to make this change ?

Thank you in advance.
 
Do you mean you want to hardcode the range for RngToName to A5:P1000?
Untested and without seeing the rest of your code:
For Each sh In SheetList
i = i + 1
If Application.Range("SheetNames").Cells(i, 1).Value <> ""
Then
With sh
Set RngToName = .Range("A5:P1000")
RngToName.Name = _
Application.Range("SheetNames").Cells(i,1).Value
End With
End If
Next sh
 
Back
Top