ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro question (https://www.excelbanter.com/excel-programming/418168-macro-question.html)

Oded Dror

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





Per Jessen

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





Dave Peterson

Macro question
 
Debra Dalgleish shares some techniques (manually and via code) he

http://contextures.com/xlDataEntry02.html
http://www.contextures.com/xlVideos01.html#FillBlanks



Oded Dror wrote:

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



--

Dave Peterson

Oded Dror

Macro question
 
Thack you all very mutch

"Oded Dror" wrote in message
...
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






All times are GMT +1. The time now is 09:50 AM.

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