LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 538
Default Moving a number

programmernovice wrote:

Say I have the number "2" in cell A1 of sheet "Assets". Can someone
please provide a simple vba command for:

1. Entering the contents of cell A1 into cell A5 of "Assets"


Sheets("Assets").Range("A5").Value = Sheets("Assets").Range("A1").Value

2. Entering the contents of cell A1 of "Assets" into cell A5 of sheet
"Liabilities".


Sheets("Liabilities").Range("A5").Value = Sheets("Assets").Range("A1").Value

(In VBA, an underscore ("_") by itself at the end of a line is a line-
continuation character.)

In the old (pre-Vba Excel) macro language which I am familiar with the
command "Formula" was used, however, it does not appear to available in
VBA.


In VBA, the .Formula property refers to, somewhat obviously, the formula,
while the .Value property refers to the displayed value. So, if A1 has a
formula of =1+1, then

Cells(1, 1).Value = 2
Cells(1, 1).Formula = "=1+1"

(Cells(1, 1) is how you refer to cells in R1C1 format. Range("A1") is of
course the other way. R1C1 is easier for me since I do a lot of looping
through every cell in a given column/row/sheet.)

I greatly appreciate all help.


It might be worth reading through a beginner's introduction the VBA. Googling
that phrase should be useful. Wikibooks has a few, but the ones I looked at
don't seem to be for beginners.

--
Power attracts the corruptible. Suspect all who seek it.
 
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
How to check if the cell contains number 1 by moving down thecolumns? cyberdude Excel Programming 6 October 17th 09 04:21 PM
Moving custom number format to NUMBER Doug Boufford Setting up and Configuration of Excel 3 July 23rd 07 11:58 PM
moving cells to another column based on number of characters JOUIOUI Excel Programming 1 June 8th 06 01:42 PM
Moving Cursor once set number of characters are entered. Parkeand Excel Programming 0 July 14th 04 05:52 AM
Moving a variable number of Sheets to another Workbook Nelson M Excel Programming 2 January 16th 04 03:01 PM


All times are GMT +1. The time now is 02:15 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"