ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Modify A Macro (https://www.excelbanter.com/excel-worksheet-functions/159982-modify-macro.html)

Carl

Modify A Macro
 
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.

JW[_2_]

Modify A Macro
 
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

carl wrote:
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.




All times are GMT +1. The time now is 12:51 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com