View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Fayyaadh Ebrahim Fayyaadh Ebrahim is offline
external usenet poster
 
Posts: 10
Default How to quickly name cells in a row using VBA?

Hi

I have to name 75 cells in a row starting from cell B4. B4 will be
named dbtr1, C4 dbtr 2 and so on.

I tried using the following code but it doesn't actually put the name
of the cell in the name box (top left had corner), however it does
show up when I go to Insert - Name - Define and it refers to the
correct cell.

I'd like the name to show up in the name box when I click the little
drop down that shows you all the named ranged in the workbook.

Sub Macro1()

Dim i As Integer

For i = 1 To 75

'ActiveWorkbook.Names.Add Name:="dbtr" & i, RefersToR1C1:="=Output
Database!R4C" & i + 1
ActiveWorkbook.Names("dbtr" & i).Delete

Next i

End Sub