ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   replacing a range with a variable? (https://www.excelbanter.com/excel-programming/284376-replacing-range-variable.html)

Kenny

replacing a range with a variable?
 

I was wanting to allow the user to specify a cell or range from an inpu
box on a form. I then wanted to use that information to specify wher
to start an autofill statement.
example

12/1/2003 (user input DATE would be the label)
1/1/2004 (' ' PATTERN ' 'l)
A1 (' ' STARTING CELL ' ')

code...

....
Range(mycell:mycell+1).AutoFill ActiveCell Range(mycell:lastCell)
xlFillFormats And xlFillSeries
....

I basicly want to replace the ...Range(*"A1:B1"*)....with
variable(s).

Thanks for any help..

-----------------------------------------------
~~ Message posted from http://www.ExcelTip.com
~~View and post usenet messages directly from http://www.ExcelForum.com

~~Now Available: Financial Statements.xls, a step by step guide to creating financial statements

patrick molloy

replacing a range with a variable?
 
use th eapplication InputBox, not the VB one, as this
allows you to specify the input type as a range - see
Help on InputBox


Dim rRange As Range
Set rRange = Application.InputBox("Select Target", "Get
Range", , , , , , 8)

8 is the Range type

Patrick Molloy
Microsoft Excel MVP


-----Original Message-----

I was wanting to allow the user to specify a cell or

range from an input
box on a form. I then wanted to use that information to

specify where
to start an autofill statement.
example

12/1/2003 (user input DATE would be the label)
1/1/2004 (' ' PATTERN ' 'l)
A1 (' ' STARTING CELL ' ')

code...

....
Range(mycell:mycell+1).AutoFill ActiveCell Range

(mycell:lastCell),
xlFillFormats And xlFillSeries
....

I basicly want to replace the ...Range

(*"A1:B1"*)....with a
variable(s).

Thanks for any help...


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from

http://www.ExcelForum.com/

~~Now Available: Financial Statements.xls, a step by

step guide to creating financial statements
.



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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com