Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Autofill last row?
Try this
Sub filldownrow() Dim rng1 As Range For a = 1 To 9 Set rng1 = Sheets("Sheet1").Cells(1, a).End(xlDown) rng1.AutoFill _ Destination:=Range(rng1, _ rng1.Offset(1, 0)), _ Type:=xlFillDefault Next End Sub -- Regards Ron de Bruin (Win XP Pro SP-1 XL2002 SP-2) www.rondebruin.nl "chris" wrote in message ... With the help of this newsgroup I was able to write the following macro to autofill the last cell in column A down one row: Sub filldownrow() Dim rng1 As Range Set rng1 = Sheets("Totals").Range("A1").End(xlDown) rng1.AutoFill _ Destination:=Range(rng1, _ rng1.Offset(1, 0)), _ Type:=xlFillDefault End Sub Now I need to do the same thing but for the entire last row (or columns A through I to be exact.) I know I could just run 9 different macros, but would prefer just one. Any help would be greatly appreciated. Chris |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Autofill last row?
Ron,
Thank you so much for your reply. That solution works great. Unfortunately it doesn't quite work for what I need because of something I forgot to mention. The top few cells in some of the columns are empty. The first row that is completely full is row 9. From there down, all cell are used. Is there any way to get it to look at A9 through I9 as the starting point? Thanks again. Chris "Ron de Bruin" wrote in message ... Try this Sub filldownrow() Dim rng1 As Range For a = 1 To 9 Set rng1 = Sheets("Sheet1").Cells(1, a).End(xlDown) rng1.AutoFill _ Destination:=Range(rng1, _ rng1.Offset(1, 0)), _ Type:=xlFillDefault Next End Sub -- Regards Ron de Bruin (Win XP Pro SP-1 XL2002 SP-2) www.rondebruin.nl "chris" wrote in message ... With the help of this newsgroup I was able to write the following macro to autofill the last cell in column A down one row: Sub filldownrow() Dim rng1 As Range Set rng1 = Sheets("Totals").Range("A1").End(xlDown) rng1.AutoFill _ Destination:=Range(rng1, _ rng1.Offset(1, 0)), _ Type:=xlFillDefault End Sub Now I need to do the same thing but for the entire last row (or columns A through I to be exact.) I know I could just run 9 different macros, but would prefer just one. Any help would be greatly appreciated. Chris |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Autofill last row?
Hi Cris
Use this then Set rng1 = Sheets("Sheet1").Cells(9, a).End(xlDown) -- Regards Ron de Bruin (Win XP Pro SP-1 XL2002 SP-2) www.rondebruin.nl "chris" wrote in message ... Ron, Thank you so much for your reply. That solution works great. Unfortunately it doesn't quite work for what I need because of something I forgot to mention. The top few cells in some of the columns are empty. The first row that is completely full is row 9. From there down, all cell are used. Is there any way to get it to look at A9 through I9 as the starting point? Thanks again. Chris "Ron de Bruin" wrote in message ... Try this Sub filldownrow() Dim rng1 As Range For a = 1 To 9 Set rng1 = Sheets("Sheet1").Cells(1, a).End(xlDown) rng1.AutoFill _ Destination:=Range(rng1, _ rng1.Offset(1, 0)), _ Type:=xlFillDefault Next End Sub -- Regards Ron de Bruin (Win XP Pro SP-1 XL2002 SP-2) www.rondebruin.nl "chris" wrote in message ... With the help of this newsgroup I was able to write the following macro to autofill the last cell in column A down one row: Sub filldownrow() Dim rng1 As Range Set rng1 = Sheets("Totals").Range("A1").End(xlDown) rng1.AutoFill _ Destination:=Range(rng1, _ rng1.Offset(1, 0)), _ Type:=xlFillDefault End Sub Now I need to do the same thing but for the entire last row (or columns A through I to be exact.) I know I could just run 9 different macros, but would prefer just one. Any help would be greatly appreciated. Chris |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Autofill last row?
Ron,
That did it. Works perfect. Thank you so much. One more question. Is there a way to do it if there is an empty colum? For example, if I wanted to have columns D and G empty for visual reasons. "Ron de Bruin" wrote in message ... Hi Cris Use this then Set rng1 = Sheets("Sheet1").Cells(9, a).End(xlDown) -- Regards Ron de Bruin (Win XP Pro SP-1 XL2002 SP-2) www.rondebruin.nl "chris" wrote in message ... Ron, Thank you so much for your reply. That solution works great. Unfortunately it doesn't quite work for what I need because of something I forgot to mention. The top few cells in some of the columns are empty. The first row that is completely full is row 9. From there down, all cell are used. Is there any way to get it to look at A9 through I9 as the starting point? Thanks again. Chris "Ron de Bruin" wrote in message ... Try this Sub filldownrow() Dim rng1 As Range For a = 1 To 9 Set rng1 = Sheets("Sheet1").Cells(1, a).End(xlDown) rng1.AutoFill _ Destination:=Range(rng1, _ rng1.Offset(1, 0)), _ Type:=xlFillDefault Next End Sub -- Regards Ron de Bruin (Win XP Pro SP-1 XL2002 SP-2) www.rondebruin.nl "chris" wrote in message ... With the help of this newsgroup I was able to write the following macro to autofill the last cell in column A down one row: Sub filldownrow() Dim rng1 As Range Set rng1 = Sheets("Totals").Range("A1").End(xlDown) rng1.AutoFill _ Destination:=Range(rng1, _ rng1.Offset(1, 0)), _ Type:=xlFillDefault End Sub Now I need to do the same thing but for the entire last row (or columns A through I to be exact.) I know I could just run 9 different macros, but would prefer just one. Any help would be greatly appreciated. Chris |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Autofill last row?
One way
If the cell in row 9 is empty it will go to the next one Sub filldownrow() Dim rng1 As Range For a = 1 To 9 If Sheets("Sheet1").Cells(9, a) < "" Then Set rng1 = Sheets("Sheet1").Cells(1, 9).End(xlDown) rng1.AutoFill _ Destination:=Range(rng1, _ rng1.Offset(1, 0)), _ Type:=xlFillDefault End If Next End Sub -- Regards Ron de Bruin (Win XP Pro SP-1 XL2002 SP-2) www.rondebruin.nl "chris" wrote in message ... Ron, That did it. Works perfect. Thank you so much. One more question. Is there a way to do it if there is an empty colum? For example, if I wanted to have columns D and G empty for visual reasons. "Ron de Bruin" wrote in message ... Hi Cris Use this then Set rng1 = Sheets("Sheet1").Cells(9, a).End(xlDown) -- Regards Ron de Bruin (Win XP Pro SP-1 XL2002 SP-2) www.rondebruin.nl "chris" wrote in message ... Ron, Thank you so much for your reply. That solution works great. Unfortunately it doesn't quite work for what I need because of something I forgot to mention. The top few cells in some of the columns are empty. The first row that is completely full is row 9. From there down, all cell are used. Is there any way to get it to look at A9 through I9 as the starting point? Thanks again. Chris "Ron de Bruin" wrote in message ... Try this Sub filldownrow() Dim rng1 As Range For a = 1 To 9 Set rng1 = Sheets("Sheet1").Cells(1, a).End(xlDown) rng1.AutoFill _ Destination:=Range(rng1, _ rng1.Offset(1, 0)), _ Type:=xlFillDefault Next End Sub -- Regards Ron de Bruin (Win XP Pro SP-1 XL2002 SP-2) www.rondebruin.nl "chris" wrote in message ... With the help of this newsgroup I was able to write the following macro to autofill the last cell in column A down one row: Sub filldownrow() Dim rng1 As Range Set rng1 = Sheets("Totals").Range("A1").End(xlDown) rng1.AutoFill _ Destination:=Range(rng1, _ rng1.Offset(1, 0)), _ Type:=xlFillDefault End Sub Now I need to do the same thing but for the entire last row (or columns A through I to be exact.) I know I could just run 9 different macros, but would prefer just one. Any help would be greatly appreciated. Chris |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Autofill last row?
Sorry : Typo
Use this one Sub filldownrow() Dim rng1 As Range For a = 1 To 9 If Sheets("Sheet1").Cells(9, a) < "" Then Set rng1 = Sheets("Sheet1").Cells(9, a).End(xlDown) rng1.AutoFill _ Destination:=Range(rng1, _ rng1.Offset(1, 0)), _ Type:=xlFillDefault End If Next a End Sub -- Regards Ron de Bruin (Win XP Pro SP-1 XL2002 SP-2) www.rondebruin.nl "Ron de Bruin" wrote in message ... One way If the cell in row 9 is empty it will go to the next one Sub filldownrow() Dim rng1 As Range For a = 1 To 9 If Sheets("Sheet1").Cells(9, a) < "" Then Set rng1 = Sheets("Sheet1").Cells(1, 9).End(xlDown) rng1.AutoFill _ Destination:=Range(rng1, _ rng1.Offset(1, 0)), _ Type:=xlFillDefault End If Next End Sub -- Regards Ron de Bruin (Win XP Pro SP-1 XL2002 SP-2) www.rondebruin.nl "chris" wrote in message ... Ron, That did it. Works perfect. Thank you so much. One more question. Is there a way to do it if there is an empty colum? For example, if I wanted to have columns D and G empty for visual reasons. "Ron de Bruin" wrote in message ... Hi Cris Use this then Set rng1 = Sheets("Sheet1").Cells(9, a).End(xlDown) -- Regards Ron de Bruin (Win XP Pro SP-1 XL2002 SP-2) www.rondebruin.nl "chris" wrote in message ... Ron, Thank you so much for your reply. That solution works great. Unfortunately it doesn't quite work for what I need because of something I forgot to mention. The top few cells in some of the columns are empty. The first row that is completely full is row 9. From there down, all cell are used. Is there any way to get it to look at A9 through I9 as the starting point? Thanks again. Chris "Ron de Bruin" wrote in message ... Try this Sub filldownrow() Dim rng1 As Range For a = 1 To 9 Set rng1 = Sheets("Sheet1").Cells(1, a).End(xlDown) rng1.AutoFill _ Destination:=Range(rng1, _ rng1.Offset(1, 0)), _ Type:=xlFillDefault Next End Sub -- Regards Ron de Bruin (Win XP Pro SP-1 XL2002 SP-2) www.rondebruin.nl "chris" wrote in message ... With the help of this newsgroup I was able to write the following macro to autofill the last cell in column A down one row: Sub filldownrow() Dim rng1 As Range Set rng1 = Sheets("Totals").Range("A1").End(xlDown) rng1.AutoFill _ Destination:=Range(rng1, _ rng1.Offset(1, 0)), _ Type:=xlFillDefault End Sub Now I need to do the same thing but for the entire last row (or columns A through I to be exact.) I know I could just run 9 different macros, but would prefer just one. Any help would be greatly appreciated. Chris |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Autofill last row?
Thank you so much. That does exactly what I want it to do. I didn't know
at first that empty columns would affect it because when I do it manually, they don't. I continue to be amazed by the level of knowledge and helpfullness exhibited on this newsgroup. I wish all were the same. It really helps when newbies like me (at least in excel programming) can come and ask questions and people are willing to help. Chris "Ron de Bruin" wrote in message ... Sorry : Typo Use this one Sub filldownrow() Dim rng1 As Range For a = 1 To 9 If Sheets("Sheet1").Cells(9, a) < "" Then Set rng1 = Sheets("Sheet1").Cells(9, a).End(xlDown) rng1.AutoFill _ Destination:=Range(rng1, _ rng1.Offset(1, 0)), _ Type:=xlFillDefault End If Next a End Sub -- Regards Ron de Bruin (Win XP Pro SP-1 XL2002 SP-2) www.rondebruin.nl "Ron de Bruin" wrote in message ... One way If the cell in row 9 is empty it will go to the next one Sub filldownrow() Dim rng1 As Range For a = 1 To 9 If Sheets("Sheet1").Cells(9, a) < "" Then Set rng1 = Sheets("Sheet1").Cells(1, 9).End(xlDown) rng1.AutoFill _ Destination:=Range(rng1, _ rng1.Offset(1, 0)), _ Type:=xlFillDefault End If Next End Sub -- Regards Ron de Bruin (Win XP Pro SP-1 XL2002 SP-2) www.rondebruin.nl "chris" wrote in message ... Ron, That did it. Works perfect. Thank you so much. One more question. Is there a way to do it if there is an empty colum? For example, if I wanted to have columns D and G empty for visual reasons. "Ron de Bruin" wrote in message ... Hi Cris Use this then Set rng1 = Sheets("Sheet1").Cells(9, a).End(xlDown) -- Regards Ron de Bruin (Win XP Pro SP-1 XL2002 SP-2) www.rondebruin.nl "chris" wrote in message ... Ron, Thank you so much for your reply. That solution works great. Unfortunately it doesn't quite work for what I need because of something I forgot to mention. The top few cells in some of the columns are empty. The first row that is completely full is row 9. From there down, all cell are used. Is there any way to get it to look at A9 through I9 as the starting point? Thanks again. Chris "Ron de Bruin" wrote in message ... Try this Sub filldownrow() Dim rng1 As Range For a = 1 To 9 Set rng1 = Sheets("Sheet1").Cells(1, a).End(xlDown) rng1.AutoFill _ Destination:=Range(rng1, _ rng1.Offset(1, 0)), _ Type:=xlFillDefault Next End Sub -- Regards Ron de Bruin (Win XP Pro SP-1 XL2002 SP-2) www.rondebruin.nl "chris" wrote in message ... With the help of this newsgroup I was able to write the following macro to autofill the last cell in column A down one row: Sub filldownrow() Dim rng1 As Range Set rng1 = Sheets("Totals").Range("A1").End(xlDown) rng1.AutoFill _ Destination:=Range(rng1, _ rng1.Offset(1, 0)), _ Type:=xlFillDefault End Sub Now I need to do the same thing but for the entire last row (or columns A through I to be exact.) I know I could just run 9 different macros, but would prefer just one. Any help would be greatly appreciated. Chris |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
Autofill last row?
You are welcome Chris.
-- Regards Ron de Bruin (Win XP Pro SP-1 XL2002 SP-2) www.rondebruin.nl "chris" wrote in message ... Thank you so much. That does exactly what I want it to do. I didn't know at first that empty columns would affect it because when I do it manually, they don't. I continue to be amazed by the level of knowledge and helpfullness exhibited on this newsgroup. I wish all were the same. It really helps when newbies like me (at least in excel programming) can come and ask questions and people are willing to help. Chris "Ron de Bruin" wrote in message ... Sorry : Typo Use this one Sub filldownrow() Dim rng1 As Range For a = 1 To 9 If Sheets("Sheet1").Cells(9, a) < "" Then Set rng1 = Sheets("Sheet1").Cells(9, a).End(xlDown) rng1.AutoFill _ Destination:=Range(rng1, _ rng1.Offset(1, 0)), _ Type:=xlFillDefault End If Next a End Sub -- Regards Ron de Bruin (Win XP Pro SP-1 XL2002 SP-2) www.rondebruin.nl "Ron de Bruin" wrote in message ... One way If the cell in row 9 is empty it will go to the next one Sub filldownrow() Dim rng1 As Range For a = 1 To 9 If Sheets("Sheet1").Cells(9, a) < "" Then Set rng1 = Sheets("Sheet1").Cells(1, 9).End(xlDown) rng1.AutoFill _ Destination:=Range(rng1, _ rng1.Offset(1, 0)), _ Type:=xlFillDefault End If Next End Sub -- Regards Ron de Bruin (Win XP Pro SP-1 XL2002 SP-2) www.rondebruin.nl "chris" wrote in message ... Ron, That did it. Works perfect. Thank you so much. One more question. Is there a way to do it if there is an empty colum? For example, if I wanted to have columns D and G empty for visual reasons. "Ron de Bruin" wrote in message ... Hi Cris Use this then Set rng1 = Sheets("Sheet1").Cells(9, a).End(xlDown) -- Regards Ron de Bruin (Win XP Pro SP-1 XL2002 SP-2) www.rondebruin.nl "chris" wrote in message ... Ron, Thank you so much for your reply. That solution works great. Unfortunately it doesn't quite work for what I need because of something I forgot to mention. The top few cells in some of the columns are empty. The first row that is completely full is row 9. From there down, all cell are used. Is there any way to get it to look at A9 through I9 as the starting point? Thanks again. Chris "Ron de Bruin" wrote in message ... Try this Sub filldownrow() Dim rng1 As Range For a = 1 To 9 Set rng1 = Sheets("Sheet1").Cells(1, a).End(xlDown) rng1.AutoFill _ Destination:=Range(rng1, _ rng1.Offset(1, 0)), _ Type:=xlFillDefault Next End Sub -- Regards Ron de Bruin (Win XP Pro SP-1 XL2002 SP-2) www.rondebruin.nl "chris" wrote in message ... With the help of this newsgroup I was able to write the following macro to autofill the last cell in column A down one row: Sub filldownrow() Dim rng1 As Range Set rng1 = Sheets("Totals").Range("A1").End(xlDown) rng1.AutoFill _ Destination:=Range(rng1, _ rng1.Offset(1, 0)), _ Type:=xlFillDefault End Sub Now I need to do the same thing but for the entire last row (or columns A through I to be exact.) I know I could just run 9 different macros, but would prefer just one. Any help would be greatly appreciated. Chris |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
AutoFill | Excel Discussion (Misc queries) | |||
AutoFill A to Z | New Users to Excel | |||
Autofill | Excel Worksheet Functions | |||
Autofill | Excel Worksheet Functions | |||
Autofill: Need to autofill one week block, (5) weekday only into cells. | Excel Discussion (Misc queries) |