Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 50112

Variable in VB Macro

$
0
0
Hello:

I have following statement in VB Macro:

ThisWorkbook.Worksheets("Inventory13").Range("F41").Resize(RowsCnt, ColsCnt) = SrcRng.Value

I wonder if it is possible to make .Range("F41") as varaible.

I need this to be the value in cell S41

If S41 is G41 then the statement would need to be :

ThisWorkbook.Worksheets("Inventory13").Range("G41").Resize(RowsCnt, ColsCnt) = SrcRng.Value

If S41 is H41 then the statement would need to be :

ThisWorkbook.Worksheets("Inventory13").Range("H41").Resize(RowsCnt, ColsCnt) = SrcRng.Value


Please help with this simple task.

Thanks

Riz

Viewing all articles
Browse latest Browse all 50112