Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 72
Default autofill more then one cell when the cells are not close to each other

is it possible to autofill data in more then one field in one command
code when the cells are not close to each other?

for example
range("A1,D1,G1).select
i would like to autofill of them at one command is it posible?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 77
Default autofill more then one cell when the cells are not close to each o

thread,

I am a vba newbie, this small excerpt should get you started and works fine
for me.

Dim Lastrow As Long
Lastrow = Worksheets("urspreadsheet").Cells(Rows.Count, "A").End(xlUp).Row

Set SourceRange = Worksheets("urspreadsheet").Range("b2")
Set fillRange = Worksheets("urspreadsheet").Range("b2:b" & Lastrow)
SourceRange.AutoFill Destination:=fillRange

Add the three lines above as necessary for other columns.


"thread" wrote:

is it possible to autofill data in more then one field in one command
code when the cells are not close to each other?

for example
range("A1,D1,G1).select
i would like to autofill of them at one command is it posible?


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default autofill more then one cell when the cells are not close to each o

No, I believe you would have to do it separately.

this plays at doing it together, but actually does it separately

Sub Autofill()
Dim SourceRange as Range, FillRange as Range
Dim ar as Range, i as Long
Set SourceRange = Worksheets("Sheet2") _
.Range("A1,D1,G1")
Set fillRange = Worksheets("Sheet2") _
.Range("A1:A20,D1:D20,G1:G20")
i = 1
For Each ar In SourceRange.Areas
ar.Autofill Destination:=fillRange.Areas(i)
i = i + 1
Next
End Sub

--
Regards,
Tom Ogilvy


"thread" wrote:

is it possible to autofill data in more then one field in one command
code when the cells are not close to each other?

for example
range("A1,D1,G1).select
i would like to autofill of them at one command is it posible?


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
I can't autofill cells in a column if blank cells in between SJ Excel Worksheet Functions 1 May 4th 08 01:27 AM
Autofill cell/sets of cells based upon value selected from a list. Brazil Excel Discussion (Misc queries) 1 February 5th 07 08:45 AM
can autofill be used on merged cells? Debbie Excel Discussion (Misc queries) 2 June 27th 06 02:38 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
How can i autofill cells Taco[_2_] Excel Programming 2 January 16th 04 01:22 PM


All times are GMT +1. The time now is 06:00 PM.

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"