Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default 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














Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
AutoFill Gmata Excel Discussion (Misc queries) 1 June 20th 09 06:59 AM
AutoFill A to Z Hardeep kanwar New Users to Excel 4 March 29th 09 07:59 AM
Autofill Mrich Excel Worksheet Functions 2 June 22nd 06 02:13 AM
Autofill sisco98 Excel Worksheet Functions 1 June 28th 05 01:30 PM
Autofill: Need to autofill one week block, (5) weekday only into cells. dstock Excel Discussion (Misc queries) 1 June 17th 05 08:21 PM


All times are GMT +1. The time now is 08:33 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"