Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Autofill Function


This there anyway to write code for the autofill function that allows
you to choose a specific number of cells to fill instead of having to
enter the range of cells?

In other words, instead of writing:

Selection.AutoFill Destination:=Range("H21:K21"),
Type:=xlFillDefault

Is it possible to write something that says autofill the 5 cells below
the cell that has been selected?

Any help is greatly appreciated.

Thanks,

Peter


--
PGalla06
------------------------------------------------------------------------
PGalla06's Profile: http://www.excelforum.com/member.php...o&userid=24260
View this thread: http://www.excelforum.com/showthread...hreadid=381649

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


Give this a try Peter.

Sub Autofil()
Dim CurRow As Long
CurRow = Selection.Row
Selection.AutoFill Destination:=Range("H" & CurRow & ":K" & CurRow +
5), Type:=xlFillDefault
End Sub

For this example you will need to have a range from H - K selected and
it will autofill the next 5 cells.

HTH


--
bhofsetz
------------------------------------------------------------------------
bhofsetz's Profile: http://www.excelforum.com/member.php...o&userid=18807
View this thread: http://www.excelforum.com/showthread...hreadid=381649

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
Excel Autofill Function [email protected] Excel Discussion (Misc queries) 1 August 4th 08 11:11 PM
No autofill VLookup function owl37 Excel Worksheet Functions 5 October 12th 06 09:41 PM
Using the autofill function but increment by certain number in function rishid Excel Worksheet Functions 1 July 14th 05 07:40 PM
INDIRECT Function and Autofill Neil Grantham Excel Worksheet Functions 1 April 21st 05 12:22 AM
Autofill & Lookup Function Chris Hankin Excel Programming 11 May 4th 04 08:18 PM


All times are GMT +1. The time now is 04:24 AM.

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

About Us

"It's about Microsoft Excel"