View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Carl Carl is offline
external usenet poster
 
Posts: 361
Default Macro Modification

I use this macro to make tables (named ranges).

How can I modify the macro so that it will set the range to A1:I1000 ?

Thanks In Advance.

Sub maketable3()

Dim SheetList As Sheets

Dim RngToName As Range

Dim LastRow As Long

Dim LastCol As Long

Dim NameToUse As String

Dim sh As Worksheet

Dim I As Long



Set SheetList = ActiveWindow.SelectedSheets

For Each sh In SheetList

I = I + 1

If Application.Range("SheetNames").Cells(I, 1).Value < "" Then

With sh

LastRow = .Range("a10").End(xlDown).Row

LastCol = .Range("a10").End(xlToRight).Column

Set RngToName = .Range("a10", .Cells(LastRow, LastCol))

RngToName.Name = Application.Range("SheetNames").Cells(I,
1).Value

End With

End If

Next sh

End Sub