![]() |
Range - setting a value in a cell
what am i doing wrong
dim myRange as Range dim iNum as integer iNum= 6 Set myRange = Cells(iNum + 2, 1) myRange.Value = 34 trying to set a cell myRange to cell(8,1) then putting the value 34 into the cell |
Range - setting a value in a cell
iNum= 6
Set myRange = Cells(iNum + 2, 1) myRange.Value = 34 The above placed in the immediate window (with sheet1 active) places 34 in cell A8 To extend this out into a full macro you need to put it in a standard module with a name like: Sub Foo() dim myRange as Range dim iNum as integer iNum= 6 Set myRange = Cells(iNum + 2, 1) myRange.Value = 34 End Sub Then just Run Foo,,, HTH "cantonarv" wrote in message oups.com... what am i doing wrong dim myRange as Range dim iNum as integer iNum= 6 Set myRange = Cells(iNum + 2, 1) myRange.Value = 34 trying to set a cell myRange to cell(8,1) then putting the value 34 into the cell |
All times are GMT +1. The time now is 01:35 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com