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

I have an Inputbox that asks for the number of couples attending an event.
If 50 is the value (stored in the variable NoCouples), and cell A1 already
contains "Couple01", I would like cell A1 to be autofilled down as follows:

Couple01
Couple02
Couple03
..
..
..
Couple50

Recording a macro that does this gives me the following line of code:
Selection.Autofill Destination:=Range("A1:A50"), Type:=xlFillDefault

How do I word my code to substitute NoCouples for A50? I've tried the
following to no avail:
Selection.Autofill Destination:=Range("A1:A + NoCouples"),
Type:=xlFillDefault

Thanks!

Steve C
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 180
Default AutoFill a Range

Take the NoCouples outside the quotes to have VB replace the string with the
value:
Selection.Autofill Destination:=Range("A1:A" & NoCouples)


"Steve C" wrote:

I have an Inputbox that asks for the number of couples attending an event.
If 50 is the value (stored in the variable NoCouples), and cell A1 already
contains "Couple01", I would like cell A1 to be autofilled down as follows:

Couple01
Couple02
Couple03
.
.
.
Couple50

Recording a macro that does this gives me the following line of code:
Selection.Autofill Destination:=Range("A1:A50"), Type:=xlFillDefault

How do I word my code to substitute NoCouples for A50? I've tried the
following to no avail:
Selection.Autofill Destination:=Range("A1:A + NoCouples"),
Type:=xlFillDefault

Thanks!

Steve C

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 59
Default AutoFill a Range


try this:
Selection.Autofill Destination:=Range("A1:A" & NoCouples),
Type:=xlFillDefault

"Steve C" wrote in message
...
I have an Inputbox that asks for the number of couples attending an event.
If 50 is the value (stored in the variable NoCouples), and cell A1 already
contains "Couple01", I would like cell A1 to be autofilled down as

follows:

Couple01
Couple02
Couple03
.
.
.
Couple50

Recording a macro that does this gives me the following line of code:
Selection.Autofill Destination:=Range("A1:A50"),

Type:=xlFillDefault

How do I word my code to substitute NoCouples for A50? I've tried the
following to no avail:
Selection.Autofill Destination:=Range("A1:A + NoCouples"),
Type:=xlFillDefault

Thanks!

Steve C



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 119
Default AutoFill a Range

Thank you both!

"Jef Gorbach" wrote:


try this:
Selection.Autofill Destination:=Range("A1:A" & NoCouples),
Type:=xlFillDefault

"Steve C" wrote in message
...
I have an Inputbox that asks for the number of couples attending an event.
If 50 is the value (stored in the variable NoCouples), and cell A1 already
contains "Couple01", I would like cell A1 to be autofilled down as

follows:

Couple01
Couple02
Couple03
.
.
.
Couple50

Recording a macro that does this gives me the following line of code:
Selection.Autofill Destination:=Range("A1:A50"),

Type:=xlFillDefault

How do I word my code to substitute NoCouples for A50? I've tried the
following to no avail:
Selection.Autofill Destination:=Range("A1:A + NoCouples"),
Type:=xlFillDefault

Thanks!

Steve C




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 with specific range Sunil Patel Excel Programming 1 June 30th 05 09:15 PM
Variable Autofill range Kate Excel Programming 2 February 23rd 04 09:20 PM
autofill range Stephen[_6_] Excel Programming 6 December 24th 03 12:57 AM
autofill with dynamic range Bernie Deitrick[_2_] Excel Programming 0 September 16th 03 02:55 PM
autofill with dynamic range again a Excel Programming 0 September 16th 03 12:26 PM


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