Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default How to: assign a value to a cell without selecting the cell first

Hi,

Its clear that I am still a newbie...

In VBA, how do I assign a value to a cell with out first selecting the cell?
In pseudo code I would describe it as "Assign the value 5 to the cell in
location x".

Kind regards

George
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default How to: assign a value to a cell without selecting the cell first

try
cells(1,5)=5
or
range("a5")=5

--
Don Guillett
SalesAid Software

"George Furnell" wrote in message
...
Hi,

Its clear that I am still a newbie...

In VBA, how do I assign a value to a cell with out first selecting the
cell?
In pseudo code I would describe it as "Assign the value 5 to the cell in
location x".

Kind regards

George



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,071
Default How to: assign a value to a cell without selecting the cell first

In the simplest form: Cells({row},{column}).value=5
More explicitly: Worksheets({worksheet id}).Cells({row},{column}).value=5

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article ,
says...
Hi,

Its clear that I am still a newbie...

In VBA, how do I assign a value to a cell with out first selecting the cell?
In pseudo code I would describe it as "Assign the value 5 to the cell in
location x".

Kind regards

George

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default How to: assign a value to a cell without selecting the cell fi

Thank you, thats what I was looking for.

Kind regards

George
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default How to: assign a value to a cell without selecting the cell first

Range("A1").Value = 1

It is also good practice to reference the workbook and worksheet

With Activeworkbook
With .Worksheets("Sheet1")
.Range("A1").Value = 5
....
End With
End With

note the leading dots

--

HTH

Bob Phillips

(remove nothere from the email address if mailing direct)

"George Furnell" wrote in message
...
Hi,

Its clear that I am still a newbie...

In VBA, how do I assign a value to a cell with out first selecting the

cell?
In pseudo code I would describe it as "Assign the value 5 to the cell in
location x".

Kind regards

George





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
Assign Color to a Cell based on another Cell on a diff Sheet VROSARIO7 Excel Worksheet Functions 2 July 6th 09 08:53 PM
Excel 2007 single cell selecting muliple cell Submit2s Excel Worksheet Functions 1 February 12th 09 04:52 PM
Selecting a cell entry based on cell validation selection Brutalius Excel Worksheet Functions 2 December 17th 08 03:44 AM
How can I assign a data for one cell from another fixed cell? new Excel user New Users to Excel 3 November 9th 07 05:46 PM
How do i assign cell A1 to show the current cursor cell in Excel? OB Excel Discussion (Misc queries) 2 October 11th 06 04:02 PM


All times are GMT +1. The time now is 01:48 PM.

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

About Us

"It's about Microsoft Excel"