#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Autofill


a8=8
b8 = 4
c8 = a8 +b8

a8: 500 and b8:b500 are populated with nos, however with the code belo

the autofill occurs only from c8 to c16, pretty sure its the las
line.help is much appreciated

Sub test()
Dim iLastRow As Long
Dim iLastCol As Long
Dim i As Long, j As Long

iLastCol = Cells(8, Columns.Count).End(xlToLeft).Column
For j = 1 To iLastCol
If Cells(8, j).HasFormula Then
iLastRow = Cells(Rows.Count, j).End(xlUp).Row
Cells(8, j).AutoFill Cells(8, j).Resize(iLastRow)
End If
Next j

End Su

--
T De Villier
-----------------------------------------------------------------------
T De Villiers's Profile: http://www.excelforum.com/member.php...fo&userid=2647
View this thread: http://www.excelforum.com/showthread.php?threadid=47601

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Autofill

Maybe you should use column B instead of the lastcol to get the last row?

iLastRow = Cells(Rows.Count, "B").End(xlUp).Row

And since you're starting in row 8, don't you want:

Cells(8, j).AutoFill Cells(8, j).Resize(iLastRow-8+1)

T De Villiers wrote:

a8=8
b8 = 4
c8 = a8 +b8

a8: 500 and b8:b500 are populated with nos, however with the code below

the autofill occurs only from c8 to c16, pretty sure its the last
line.help is much appreciated

Sub test()
Dim iLastRow As Long
Dim iLastCol As Long
Dim i As Long, j As Long

iLastCol = Cells(8, Columns.Count).End(xlToLeft).Column
For j = 1 To iLastCol
If Cells(8, j).HasFormula Then
iLastRow = Cells(Rows.Count, j).End(xlUp).Row
Cells(8, j).AutoFill Cells(8, j).Resize(iLastRow)
End If
Next j

End Sub

--
T De Villiers
------------------------------------------------------------------------
T De Villiers's Profile: http://www.excelforum.com/member.php...o&userid=26479
View this thread: http://www.excelforum.com/showthread...hreadid=476011


--

Dave Peterson
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 grambo Excel Discussion (Misc queries) 1 October 9th 06 02:55 AM
AutoFill Sherbear New Users to Excel 2 January 28th 06 02:53 AM
Autofill: Need to autofill one week block, (5) weekday only into cells. dstock Excel Discussion (Misc queries) 1 June 17th 05 08:21 PM
Q. Autofill question: Can I autofill alpha characters like I can numbers? George[_22_] Excel Programming 5 August 7th 04 10:33 AM
Autofill Carmela[_2_] Excel Programming 1 February 9th 04 02:40 AM


All times are GMT +1. The time now is 12:38 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"