Thread: Macro question
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Per Jessen Per Jessen is offline
external usenet poster
 
Posts: 1,533
Default Macro question

Hi

Try this:

Sub FillIn()
Dim LetterCol As String
Dim NumCol As String
Dim FirstRow As Long
Dim LastRow As Long

LetterCol = "A"
NumCol = "B"
FirstRow = 1
LastRow = Cells(FirstRow, NumCol).End(xlDown).Row

For r = FirstRow To LastRow
If Cells(r, LetterCol).Value < "" Then
FillLetter = Cells(r, LetterCol)
Else
Cells(r, LetterCol).Value = FillLetter
End If
Next
End Sub

Regards,
Per

"Oded Dror" skrev i meddelelsen
...
Hi there,

I have two column look like this

A 1
2
3
4
B 1
2
C 1
2
3
D 1
2
And I want it to be

A 1
A 2
A 3
A 4
B 1
B 2
C 1
C 2
C 3
D 1
D 2
Another word to fill the empty space with the above letter
It always start with some letter and number at the top

Thanks,
Oded Dror