PC Review


Reply
Thread Tools Rate Thread

2B or not 2B? - Go to cell Bx, depending on what row is selected

 
 
bony_tony
Guest
Posts: n/a
 
      24th Apr 2007
Hi,
I'm no vba programmer, I can record macros, do loops etc, but I'm not
sure how/why each statement is structured the way it is.
What I want to do is store the value from a specific cell. The cell
is located in column B, and in the row of the current selection. ie,
if cell J23 is selected, I want to store the value of J2 as i. If A1
is the current selected cell, then it should be A2 which is stored as
i...

>From trying to figure it out myself, i've got

i = Cells(Row.Selection, 2)
Can someone tell me where I'm going wrong?

Cheers

 
Reply With Quote
 
 
 
 
=?Utf-8?B?SGFsaW0=?=
Guest
Posts: n/a
 
      24th Apr 2007
try this :
i Cells(Selection.Row, 2)

Regards,

Halim


"bony_tony" wrote:

> Hi,
> I'm no vba programmer, I can record macros, do loops etc, but I'm not
> sure how/why each statement is structured the way it is.
> What I want to do is store the value from a specific cell. The cell
> is located in column B, and in the row of the current selection. ie,
> if cell J23 is selected, I want to store the value of J2 as i. If A1
> is the current selected cell, then it should be A2 which is stored as
> i...
>
> >From trying to figure it out myself, i've got

> i = Cells(Row.Selection, 2)
> Can someone tell me where I'm going wrong?
>
> Cheers
>
>

 
Reply With Quote
 
JE McGimpsey
Guest
Posts: n/a
 
      24th Apr 2007
One way:

i = Cells(ActiveCell.Row, 2).Value


In article <(E-Mail Removed)>,
bony_tony <(E-Mail Removed)> wrote:

> Hi,
> I'm no vba programmer, I can record macros, do loops etc, but I'm not
> sure how/why each statement is structured the way it is.
> What I want to do is store the value from a specific cell. The cell
> is located in column B, and in the row of the current selection. ie,
> if cell J23 is selected, I want to store the value of J2 as i. If A1
> is the current selected cell, then it should be A2 which is stored as
> i...
>
> >From trying to figure it out myself, i've got

> i = Cells(Row.Selection, 2)
> Can someone tell me where I'm going wrong?
>
> Cheers

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I show a picture depending on what data is selected in a cell =?Utf-8?B?TGVzbGV5IE11cnJheQ==?= Microsoft Excel Misc 3 12th Apr 2007 04:34 PM
Cell data depending on column selected. vincentwongau@gmail.com Microsoft Excel Programming 1 1st May 2006 10:54 AM
Want add color to the cell depending on the value selected from th =?Utf-8?B?dmlrc2hh?= Microsoft Excel Programming 1 16th Aug 2005 07:11 PM
Calculate a field depending on what is selected in another =?Utf-8?B?ZGF2aWRnMjM1Ng==?= Microsoft Access Forms 2 9th Dec 2004 05:57 PM
Changing cell colour when cell selected/de-selected by mouse/arrow keys Joe Hannett Microsoft Excel Misc 5 12th Aug 2004 05:39 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:22 PM.