Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Getting Started - Referencing Cells
Hey,
I've been coding a bit in Access lately, so I know the basics of VB. What I don't know is how to reference specific cells. I know that the current column is '.column', and the current row is '.row', and the value of the current cell is '.value'. I am trying to assign a value to the cell right below the current cell. I'd like to do something like this: (.column, .row + 1).value = 2 * x + 1 Anyone know how to code this? Thanks! Nick |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Getting Started - Referencing Cells
ActiveCell.offset(1,0).Value = 2 * x + 1
-- Regards, Tom Ogilvy "Tatakau" wrote in message ... Hey, I've been coding a bit in Access lately, so I know the basics of VB. What I don't know is how to reference specific cells. I know that the current column is '.column', and the current row is '.row', and the value of the current cell is '.value'. I am trying to assign a value to the cell right below the current cell. I'd like to do something like this: (.column, .row + 1).value = 2 * x + 1 Anyone know how to code this? Thanks! Nick |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Getting Started - Referencing Cells
That did it!
Though I had to use an offset of (0,0) to assign a value to a cell that was right below the current cell, instead of (1,0)... not sure why. Guess it's just the coding convention. Thanks! Nick "Tom Ogilvy" wrote: ActiveCell.offset(1,0).Value = 2 * x + 1 -- Regards, Tom Ogilvy "Tatakau" wrote in message ... Hey, I've been coding a bit in Access lately, so I know the basics of VB. What I don't know is how to reference specific cells. I know that the current column is '.column', and the current row is '.row', and the value of the current cell is '.value'. I am trying to assign a value to the cell right below the current cell. I'd like to do something like this: (.column, .row + 1).value = 2 * x + 1 Anyone know how to code this? Thanks! Nick |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Getting Started - Referencing Cells
No, Offset is zero based.
If you had to use 0,0, then there is a miscommunication. demo'd from the immediate window in the VBE: ? Range("A1").Offset(0,0).Address $A$1 ? Range("A1").Offset(1,0).Address $A$2 -- Regards, Tom Ogilvy "Tatakau" wrote in message ... That did it! Though I had to use an offset of (0,0) to assign a value to a cell that was right below the current cell, instead of (1,0)... not sure why. Guess it's just the coding convention. Thanks! Nick "Tom Ogilvy" wrote: ActiveCell.offset(1,0).Value = 2 * x + 1 -- Regards, Tom Ogilvy "Tatakau" wrote in message ... Hey, I've been coding a bit in Access lately, so I know the basics of VB. What I don't know is how to reference specific cells. I know that the current column is '.column', and the current row is '.row', and the value of the current cell is '.value'. I am trying to assign a value to the cell right below the current cell. I'd like to do something like this: (.column, .row + 1).value = 2 * x + 1 Anyone know how to code this? Thanks! Nick |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Getting Started - Referencing Cells
Ahhhh whoops. Alright, I don't know if the Offset command is going to work
for me. It looks like when I use the .Offset command, it doesn't use the cell that I had just edited - it uses the cell that I move to AFTER I edit a cell. Which just doesn't work. So I should probabl rephrase the question: I want to change the value of a cell with column X and row Y. How do I code that? Thanks, Nick "Tom Ogilvy" wrote: No, Offset is zero based. If you had to use 0,0, then there is a miscommunication. demo'd from the immediate window in the VBE: ? Range("A1").Offset(0,0).Address $A$1 ? Range("A1").Offset(1,0).Address $A$2 -- Regards, Tom Ogilvy "Tatakau" wrote in message ... That did it! Though I had to use an offset of (0,0) to assign a value to a cell that was right below the current cell, instead of (1,0)... not sure why. Guess it's just the coding convention. Thanks! Nick "Tom Ogilvy" wrote: ActiveCell.offset(1,0).Value = 2 * x + 1 -- Regards, Tom Ogilvy "Tatakau" wrote in message ... Hey, I've been coding a bit in Access lately, so I know the basics of VB. What I don't know is how to reference specific cells. I know that the current column is '.column', and the current row is '.row', and the value of the current cell is '.value'. I am trying to assign a value to the cell right below the current cell. I'd like to do something like this: (.column, .row + 1).value = 2 * x + 1 Anyone know how to code this? Thanks! Nick |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Getting Started - Referencing Cells
Cells(.row + 1,.column).Value = 2 * x + 1
However, if you can get .row and .column then this is the long way around the block. It sounds like you are using the change event and using ActiveCell instead of target. Private Sub Worksheet_Change(ByVal Target As Range) MsgBox ActiveCell.Address & " - " & Target.Address End Sub Target holds the reference to the cell that triggered the event. -- Regards, Tom Ogilvy "Tatakau" wrote in message ... Ahhhh whoops. Alright, I don't know if the Offset command is going to work for me. It looks like when I use the .Offset command, it doesn't use the cell that I had just edited - it uses the cell that I move to AFTER I edit a cell. Which just doesn't work. So I should probabl rephrase the question: I want to change the value of a cell with column X and row Y. How do I code that? Thanks, Nick "Tom Ogilvy" wrote: No, Offset is zero based. If you had to use 0,0, then there is a miscommunication. demo'd from the immediate window in the VBE: ? Range("A1").Offset(0,0).Address $A$1 ? Range("A1").Offset(1,0).Address $A$2 -- Regards, Tom Ogilvy "Tatakau" wrote in message ... That did it! Though I had to use an offset of (0,0) to assign a value to a cell that was right below the current cell, instead of (1,0)... not sure why. Guess it's just the coding convention. Thanks! Nick "Tom Ogilvy" wrote: ActiveCell.offset(1,0).Value = 2 * x + 1 -- Regards, Tom Ogilvy "Tatakau" wrote in message ... Hey, I've been coding a bit in Access lately, so I know the basics of VB. What I don't know is how to reference specific cells. I know that the current column is '.column', and the current row is '.row', and the value of the current cell is '.value'. I am trying to assign a value to the cell right below the current cell. I'd like to do something like this: (.column, .row + 1).value = 2 * x + 1 Anyone know how to code this? Thanks! Nick |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
referencing cells based on conditions in other cells | Excel Discussion (Misc queries) | |||
Referencing Cells | Excel Worksheet Functions | |||
Referencing other cells | Excel Discussion (Misc queries) | |||
I've started designing a combo box and have the look up cells referenced. | New Users to Excel | |||
Referencing Cells | Excel Worksheet Functions |