o z
asked on
VBA Autofill Column
Looking for sub routine that copies values from one cell down until it no longer sees empty cells. Then as sub routine continues copy NEW value from non-empty cell into empty cells below it until again it encounters yet another non-empty cell picking up third new value again and continuing on until it hits row 1000.
Column A
empty cell
empty cell
FIRST VALUE
empty cell
SECOND VALUE
empty cell
empty cell
empty cell
THIRD VALUE
empty cell
empty cell
RUNNING MACRO SHOULD RESULT IN THE FOLLOWING
Column A
empty cell
empty cell
FIRST VALUE
FIRST VALUE
SECOND VALUE
SECOND VALUE
SECOND VALUE
SECOND VALUE
THIRD VALUE
THIRD VALUE
THIRD VALUE
Recording macro using something like, selection.autofill destination:=Range(a3:a4); however i believe i need solution to use dynamic variables as empty cells will always differ.
Column A
empty cell
empty cell
FIRST VALUE
empty cell
SECOND VALUE
empty cell
empty cell
empty cell
THIRD VALUE
empty cell
empty cell
RUNNING MACRO SHOULD RESULT IN THE FOLLOWING
Column A
empty cell
empty cell
FIRST VALUE
FIRST VALUE
SECOND VALUE
SECOND VALUE
SECOND VALUE
SECOND VALUE
THIRD VALUE
THIRD VALUE
THIRD VALUE
Recording macro using something like, selection.autofill destination:=Range(a3:a4);
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You may want to look at this link below. This could be a good start.
The other option would be to get a friend like Martin Liss beside you. He actually showed me a lot, last couple of year. :-)
The link below will have cases + macro code + the Excel template with the macro + the video that goes with it.
Multiple hours of fun!!!!!!!
Free VBA Training Videos
The other option would be to get a friend like Martin Liss beside you. He actually showed me a lot, last couple of year. :-)
The link below will have cases + macro code + the Excel template with the macro + the video that goes with it.
Multiple hours of fun!!!!!!!
Free VBA Training Videos
Here's my code modified to look at columns G and F.
In any case I'm glad I was able to help.
In my profile you'll find links to some articles I've written that may interest you.
Marty - MVP 2009 to 2014
Sub FillBlanks()
Dim lngRow As Long
Dim strValue As String
Dim lngLastRowF As Long
' Find the last populated cell in column F
lngLastRowF = Range("F1048576").End(xlUp).Row
' If you want to stop at the line *before* the last cell in F then
' replace the "For" line with this
'For lngRow = 1 To lngLastRowF - 1
For lngRow = 1 To lngLastRowF
' Look at values in column G. The syntax of Cells is Cells(row number, column number)
If Cells(lngRow, 7) <> "" Then
strValue = Cells(lngRow, 7)
Else
Cells(lngRow, 7) = strValue
End If
Next
End Sub
In any case I'm glad I was able to help.
In my profile you'll find links to some articles I've written that may interest you.
Marty - MVP 2009 to 2014
ASKER
Wilder, your solution worked perfectly as I was able to modify column number to specify G.
I appreciate your help equally and have one last question... what other sites would you suggest I familiarize myself with to pick up such VBA skills. Thanks!