Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Stopping Autofill at alst line of file


I use the code below to autofill columns,(using formulas), which is done
successfully except that it creates garbage past the last line of the
file.

Range("V2:AF2").AutoFill Destination:=Range("V2",
Range("AF2").End(xlDown)(0))

How can I stop it doing this to row 65536?
Thanks


--
leskoby
------------------------------------------------------------------------
leskoby's Profile: http://www.excelforum.com/member.php...o&userid=26616
View this thread: http://www.excelforum.com/showthread...hreadid=399956

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Stopping Autofill at alst line of file


leskoby

There are several ways to do this. Here is one way

This finds last row with data in it then autofills down to that row

Dim GetBottomRow As Long
GetBottomRow = Cells.Find(what:="*", SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious).Row


Range("v2:af2").AutoFill Destination:= _
Range("v2:af" & GetBottomRow), Type:=xlFillDefault


--
mudraker
------------------------------------------------------------------------
mudraker's Profile: http://www.excelforum.com/member.php...fo&userid=2473
View this thread: http://www.excelforum.com/showthread...hreadid=399956

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Stopping Autofill at alst line of file


Thanks Mudraker, worked like a charm.


--
leskoby
------------------------------------------------------------------------
leskoby's Profile: http://www.excelforum.com/member.php...o&userid=26616
View this thread: http://www.excelforum.com/showthread...hreadid=399956

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
Graphing: Stopping the downvard line Khai N[_2_] Excel Worksheet Functions 2 June 5th 08 12:12 PM
Starting and Stopping excel from command line. Bruce Edwards Excel Discussion (Misc queries) 1 April 27th 08 06:34 PM
Stopping chart line where 1 of 2 columns of data in calculation is blank Roger B. Charts and Charting in Excel 2 July 17th 05 07:32 PM
Stopping Date Autofill in Chart Wizard Ripper Excel Discussion (Misc queries) 1 February 25th 05 02:10 AM
Reads entire *.txt file into string opposed to a desired line by line input. ej_user Excel Programming 3 October 11th 04 07:15 PM


All times are GMT +1. The time now is 05:12 PM.

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"