Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 430
Default 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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel Addin:Setting the range to the Excel.Range object range prop Rp007 Excel Worksheet Functions 5 November 24th 06 04:30 PM
setting range().hidden=True causes range error 1004 STEVE BELL Excel Programming 6 September 2nd 05 02:16 AM
changing the currenc setting of a cell or range Chris Excel Programming 9 December 10th 04 08:23 AM
Setting a range with the last used cell? andycharger[_42_] Excel Programming 2 July 2nd 04 09:43 PM
Setting a range value to the last cell in active worksheet. Don Excel Programming 3 June 24th 04 02:04 PM


All times are GMT +1. The time now is 12:21 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"