Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default Using relative references in macro

I want to move the contents of a cell (in an array) when I know its column
and relative row number. The requested cell (date & time format) is in
Column D and its relative row # is in cell E5. I want to move the contents
of this cell to cell B1. The following is a sample of the table:

Col D
7/16/2009 23:23:57
7/17/2009 4:10:07
7/17/2009 5:40:25
7/17/2009 20:58:30
7/17/2009 23:22:49
7/18/2009 3:00:51
7/18/2009 5:58:52

I've tried various approaches to specify the relative cell's location so I
can move its contents but with no success. Help. Thanks for your assistance.
Jim

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Using relative references in macro

If I understand your question correctly, try this...

Range("B1").Value = Cells(Range("E5").Value, "D").Value

--
Rick (MVP - Excel)


"Cinco" wrote in message
...
I want to move the contents of a cell (in an array) when I know its column
and relative row number. The requested cell (date & time format) is in
Column D and its relative row # is in cell E5. I want to move the
contents
of this cell to cell B1. The following is a sample of the table:

Col D
7/16/2009 23:23:57
7/17/2009 4:10:07
7/17/2009 5:40:25
7/17/2009 20:58:30
7/17/2009 23:22:49
7/18/2009 3:00:51
7/18/2009 5:58:52

I've tried various approaches to specify the relative cell's location so I
can move its contents but with no success. Help. Thanks for your
assistance.
Jim


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default Using relative references in macro

Rick,

It does what I want except I am 1 row low re the contents that I want to
move. How do I change your command to move the contents of my relative row #
+1? Thanks again for your help. BTW, all my attempts were much more
complicated than the simple one line solution that you provided, and none of
mine worked.
Jim

"Rick Rothstein" wrote:

If I understand your question correctly, try this...

Range("B1").Value = Cells(Range("E5").Value, "D").Value

--
Rick (MVP - Excel)


"Cinco" wrote in message
...
I want to move the contents of a cell (in an array) when I know its column
and relative row number. The requested cell (date & time format) is in
Column D and its relative row # is in cell E5. I want to move the
contents
of this cell to cell B1. The following is a sample of the table:

Col D
7/16/2009 23:23:57
7/17/2009 4:10:07
7/17/2009 5:40:25
7/17/2009 20:58:30
7/17/2009 23:22:49
7/18/2009 3:00:51
7/18/2009 5:58:52

I've tried various approaches to specify the relative cell's location so I
can move its contents but with no success. Help. Thanks for your
assistance.
Jim



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Using relative references in macro

Do you mean you want to add one to whatever is in E5? Is so...

Range("B1").Value = Cells(Range("E5").Value + 1, "D").Value

--
Rick (MVP - Excel)


"Cinco" wrote in message
...
Rick,

It does what I want except I am 1 row low re the contents that I want to
move. How do I change your command to move the contents of my relative
row #
+1? Thanks again for your help. BTW, all my attempts were much more
complicated than the simple one line solution that you provided, and none
of
mine worked.
Jim

"Rick Rothstein" wrote:

If I understand your question correctly, try this...

Range("B1").Value = Cells(Range("E5").Value, "D").Value

--
Rick (MVP - Excel)


"Cinco" wrote in message
...
I want to move the contents of a cell (in an array) when I know its
column
and relative row number. The requested cell (date & time format) is in
Column D and its relative row # is in cell E5. I want to move the
contents
of this cell to cell B1. The following is a sample of the table:

Col D
7/16/2009 23:23:57
7/17/2009 4:10:07
7/17/2009 5:40:25
7/17/2009 20:58:30
7/17/2009 23:22:49
7/18/2009 3:00:51
7/18/2009 5:58:52

I've tried various approaches to specify the relative cell's location
so I
can move its contents but with no success. Help. Thanks for your
assistance.
Jim




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
Macro using relative references warp9 Excel Worksheet Functions 5 October 21st 08 04:21 AM
Fixed and Relative Macro References uturnabout Excel Programming 7 June 4th 08 05:41 PM
Relative references and macro programming Ruth[_4_] Excel Programming 8 October 27th 05 03:30 AM
macro vba relative references aut1jlt Excel Worksheet Functions 0 April 20th 05 06:13 PM
Making a macro references relative S.V.Proff Excel Programming 2 November 3rd 03 10:42 PM


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