ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   value of a cell based upon column letter and variable for row# (https://www.excelbanter.com/excel-programming/274588-value-cell-based-upon-column-letter-variable-row.html)

Tod[_2_]

value of a cell based upon column letter and variable for row#
 
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



Tom Ogilvy

value of a cell based upon column letter and variable for row#
 
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

--
Regards,
Tom Ogilvy


Tod wrote in message
rver.com...
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






All times are GMT +1. The time now is 11:53 AM.

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