Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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
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
referencing cells based on conditions in other cells mirskman Excel Discussion (Misc queries) 1 January 29th 09 09:57 PM
Referencing Cells PAL Excel Worksheet Functions 1 January 23rd 08 08:40 AM
Referencing other cells vfoley Excel Discussion (Misc queries) 4 April 30th 07 05:30 PM
I've started designing a combo box and have the look up cells referenced. Marc New Users to Excel 0 March 14th 06 09:45 PM
Referencing Cells Bill W Excel Worksheet Functions 0 August 4th 05 05:10 PM


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