Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Newbie help neede with Excel VBA 1

Status
Not open for further replies.

artsi03

Instructor
Jan 19, 2005
20
0
0
FI
Hi!

I have data on my excel sheet that needs to be copied to a certain row and column. I'm making a form button that excecutes a macro script. Now, my 1.st copy attempt looks like this:

Range("A4").Select
Selection.Copy
Range("C12").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False

I want the "C12" to be changed by a variable I have set in my sheet with Count command. Whenever a new row is copied to the sheet, the counter goes up by 1. Counter resides in cell D9 at my sheet.

How can I make my script's Range("C12") change to C13, C14 etc.. according to the value I have on my D9 cell? Is there a command like Range("C"+value.from"D9") or something?

I'm totally newbie on this. So any help will be most appriciated.

Thank you.
 
Hi artsi03,

The property you want is Offset, for example ..

[blue][tt] Range("C12").Offset(Range("D9").Value)[/tt][/blue]

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
Excel VBA Training and more Help at [url=http://www.vbaexpress.
 
Thanks, just what I needed! :)

This site is #1 :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top