Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi ,
I have data in column A in sa "A2". If "A3" is blank then I want to copy the value from "A2". Next I would expect the macro to go to the next populated cell in column A eg. "A4" and copy "A4" to "A5" and so forth. Thanks, Manir |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub ABC()
set rng = cells(rows.count,1).End(xlup) rng.offset(1,0).Filldown End Sub -- Regards, Tom Ogilvy "manfareed" wrote: Hi , I have data in column A in sa "A2". If "A3" is blank then I want to copy the value from "A2". Next I would expect the macro to go to the next populated cell in column A eg. "A4" and copy "A4" to "A5" and so forth. Thanks, Manir |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Tom,
Thanks but this does not work in this instance. Regards, Manir "Tom Ogilvy" wrote: Sub ABC() set rng = cells(rows.count,1).End(xlup) rng.offset(1,0).Filldown End Sub -- Regards, Tom Ogilvy "manfareed" wrote: Hi , I have data in column A in sa "A2". If "A3" is blank then I want to copy the value from "A2". Next I would expect the macro to go to the next populated cell in column A eg. "A4" and copy "A4" to "A5" and so forth. Thanks, Manir |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub fill_er_up()
n = Cells(Rows.Count, 1).End(xlUp).Row For i = 2 To n If IsEmpty(Cells(i, 1)) Then Cells(i, 1).Value = Cells(i - 1, 1).Value End If Next End Sub this is coded for column A, can be modified for any column. -- Gary''s Student - gsnu200747 "manfareed" wrote: Hi , I have data in column A in sa "A2". If "A3" is blank then I want to copy the value from "A2". Next I would expect the macro to go to the next populated cell in column A eg. "A4" and copy "A4" to "A5" and so forth. Thanks, Manir |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
It works but how do I ensure that it is the same format as the line above i.e. font colour etc. Thanks, Manir "Gary''s Student" wrote: Sub fill_er_up() n = Cells(Rows.Count, 1).End(xlUp).Row For i = 2 To n If IsEmpty(Cells(i, 1)) Then Cells(i, 1).Value = Cells(i - 1, 1).Value End If Next End Sub this is coded for column A, can be modified for any column. -- Gary''s Student - gsnu200747 "manfareed" wrote: Hi , I have data in column A in sa "A2". If "A3" is blank then I want to copy the value from "A2". Next I would expect the macro to go to the next populated cell in column A eg. "A4" and copy "A4" to "A5" and so forth. Thanks, Manir |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub ABC()
Dim rng As Range, ar As Range Set rng = Columns(1).SpecialCells(xlBlanks) For Each ar In rng.Areas ar(0).Copy ar Next End Sub -- Regards, Tom Ogilvy "manfareed" wrote: Hi, It works but how do I ensure that it is the same format as the line above i.e. font colour etc. Thanks, Manir "Gary''s Student" wrote: Sub fill_er_up() n = Cells(Rows.Count, 1).End(xlUp).Row For i = 2 To n If IsEmpty(Cells(i, 1)) Then Cells(i, 1).Value = Cells(i - 1, 1).Value End If Next End Sub this is coded for column A, can be modified for any column. -- Gary''s Student - gsnu200747 "manfareed" wrote: Hi , I have data in column A in sa "A2". If "A3" is blank then I want to copy the value from "A2". Next I would expect the macro to go to the next populated cell in column A eg. "A4" and copy "A4" to "A5" and so forth. Thanks, Manir |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Excellent ...
Thanks "Tom Ogilvy" wrote: Sub ABC() Dim rng As Range, ar As Range Set rng = Columns(1).SpecialCells(xlBlanks) For Each ar In rng.Areas ar(0).Copy ar Next End Sub -- Regards, Tom Ogilvy "manfareed" wrote: Hi, It works but how do I ensure that it is the same format as the line above i.e. font colour etc. Thanks, Manir "Gary''s Student" wrote: Sub fill_er_up() n = Cells(Rows.Count, 1).End(xlUp).Row For i = 2 To n If IsEmpty(Cells(i, 1)) Then Cells(i, 1).Value = Cells(i - 1, 1).Value End If Next End Sub this is coded for column A, can be modified for any column. -- Gary''s Student - gsnu200747 "manfareed" wrote: Hi , I have data in column A in sa "A2". If "A3" is blank then I want to copy the value from "A2". Next I would expect the macro to go to the next populated cell in column A eg. "A4" and copy "A4" to "A5" and so forth. Thanks, Manir |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub fill_er_up2()
n = Cells(Rows.Count, 1).End(xlUp).Row For i = 2 To n If IsEmpty(Cells(i, 1)) Then Cells(i, 1).FillDown End If Next End Sub -- Gary''s Student - gsnu200747 "manfareed" wrote: Hi, It works but how do I ensure that it is the same format as the line above i.e. font colour etc. Thanks, Manir "Gary''s Student" wrote: Sub fill_er_up() n = Cells(Rows.Count, 1).End(xlUp).Row For i = 2 To n If IsEmpty(Cells(i, 1)) Then Cells(i, 1).Value = Cells(i - 1, 1).Value End If Next End Sub this is coded for column A, can be modified for any column. -- Gary''s Student - gsnu200747 "manfareed" wrote: Hi , I have data in column A in sa "A2". If "A3" is blank then I want to copy the value from "A2". Next I would expect the macro to go to the next populated cell in column A eg. "A4" and copy "A4" to "A5" and so forth. Thanks, Manir |
#9
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Many Thanks ...
"Gary''s Student" wrote: Sub fill_er_up2() n = Cells(Rows.Count, 1).End(xlUp).Row For i = 2 To n If IsEmpty(Cells(i, 1)) Then Cells(i, 1).FillDown End If Next End Sub -- Gary''s Student - gsnu200747 "manfareed" wrote: Hi, It works but how do I ensure that it is the same format as the line above i.e. font colour etc. Thanks, Manir "Gary''s Student" wrote: Sub fill_er_up() n = Cells(Rows.Count, 1).End(xlUp).Row For i = 2 To n If IsEmpty(Cells(i, 1)) Then Cells(i, 1).Value = Cells(i - 1, 1).Value End If Next End Sub this is coded for column A, can be modified for any column. -- Gary''s Student - gsnu200747 "manfareed" wrote: Hi , I have data in column A in sa "A2". If "A3" is blank then I want to copy the value from "A2". Next I would expect the macro to go to the next populated cell in column A eg. "A4" and copy "A4" to "A5" and so forth. Thanks, Manir |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How can I autofill dates having a blank cell between each day? | New Users to Excel | |||
I can't autofill cells in a column if blank cells in between | Excel Worksheet Functions | |||
Identify Last Cell and autofill last column | Excel Programming | |||
Autofill until blank cell is reached | Excel Programming | |||
Autofill until blank cell is reached | Excel Discussion (Misc queries) |