Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default Variable in Range for excel

Can someone help

Hi,

I am trying to make my workbook more dynamic. My code is pretty simple, copy
formula's from one column to the next. Each month the user will run the code.
The problem is that the columns are not static and will move over one column
each month. My solution was to have the user input a value into cell C1 and
C2 for the column to be copied and the column to be copied to.

Here is my code. How do I insert the variable's into the range? I know I
need to remove the "H" in the range and put in Var1/Var2...just not sure how
to do this.

Sub NextMonth()

Dim Var1 As String
Dim Var2 As String

Var1 = Sheets("Summary").Cells(1, 3)
Var2 = Sheets("Summary").Cells(2, 3)

Range("H5:H7").Select
Selection.AutoFill Destination:=Range("H5:I7"), Type:=xlFillDefault
Range("H5:I7").Select

End Sub

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
VBA Excel how to assign name in variable range Mouimet Excel Programming 4 November 14th 08 05:56 PM
Excel VBA Sheet(variable).range... possible ? Phil Excel Programming 1 July 18th 06 09:00 PM
How do I set up a variable reference range in Excel? Pecan1862 Excel Programming 1 January 27th 06 09:29 PM
setting a range variable equal to the value of a string variable Pilgrim Excel Programming 2 July 1st 04 11:32 PM
Problem trying to us a range variable as an array variable TBA[_2_] Excel Programming 4 September 27th 03 02:56 PM


All times are GMT +1. The time now is 09:25 AM.

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"