Variable in Range

J

James C.

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
 
D

Douglas J. Steele

Sorry, but this newsgroup is for questions about Access, the database
product that's part of Office Professional.

You'd be best off reposting your question to a newsgroup related to Excel.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top