value of a cell based upon column letter and variable for row#

T

Tod

Please forgive the dumb question....
A user enters daily data into a worksheet. I need to create a macro that
inserts the daily values from that worksheet into a different worksheet based
upon the value of a variable. The values from the daily worksheet are from 3
or 4 columns and about 20 rows. They will all need to placed into cells in
one row on the other worksheet. For example...

If variable equals 2
Daily Worksheet --> Monthly Worksheet
A1 --> B2
A9 --> C2
D15 --> D2
C30 --> E2

I am completely lost. Please help!

TIA,
Tod
 
T

Tom Ogilvy

Dim lngVar as Long
Dim sh as Worksheet, j as long, i as long
Dim varr as variant
lngVar = 2
set sh = worksheets("Daily")
varr = Array("A1","A9","D15","C30")
with Worksheets("Monthly)
j = 1
for i = lbound(varr) to ubound(varr)
j = j + 1
.Cells(lngVar,j).Value = sh.Range(varr(i)).Value
Next
End With
 

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