Macro question

  • Thread starter Thread starter Oded Dror
  • Start date Start date
O

Oded Dror

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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top