Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 217
Default Locate Value in a set Row, with Dynamic Column

Hi,

I have some data and the headers for the numbers are months. All the months
are on row 7. I need to add some code to start looking in row 7 (cell A7)
and look at each column to locate the relevant date entered in cell A1.

Example: The code needs to look at cell A7, then B7, then C7 etc etc until
it locates the right value.

How can I do this please?

Thanks,
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default Locate Value in a set Row, with Dynamic Column

What do you want thew code to do when it finds the match?


"Louise" wrote in message
...
Hi,

I have some data and the headers for the numbers are months. All the
months
are on row 7. I need to add some code to start looking in row 7 (cell A7)
and look at each column to locate the relevant date entered in cell A1.

Example: The code needs to look at cell A7, then B7, then C7 etc etc until
it locates the right value.

How can I do this please?

Thanks,



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 217
Default Locate Value in a set Row, with Dynamic Column

Actually I worked it out - Thanks anyway..

Range("B7").Select
Do
If ActiveCell < nowmonth Then
ActiveCell.Offset(0, 1).Select
End If
Loop Until ActiveCell = nowmonth

ActiveCell.Offset(1, 0).Select


:)


"Louise" wrote:

Hi,

I have some data and the headers for the numbers are months. All the months
are on row 7. I need to add some code to start looking in row 7 (cell A7)
and look at each column to locate the relevant date entered in cell A1.

Example: The code needs to look at cell A7, then B7, then C7 etc etc until
it locates the right value.

How can I do this please?

Thanks,

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Locate Value in a set Row, with Dynamic Column

If I understand what you want correctly (A1 contains a **real** Excel date
whose month you want to find in Row 7 where A7 contains January, B7 contains
February, etc.), then this single line of code should do what your 7 lines
of code do...

Cells(7, Month(Range("A1").Value)).Offset(1).Select

By the way, the code you posted starts looking from B7, but your original
message seemed to indicate that January was in A7... your code, as written,
will not find a January date... you would need to change your B7 to A7 to
make it work as you originally described the problem.

--
Rick (MVP - Excel)


"Louise" wrote in message
...
Actually I worked it out - Thanks anyway..

Range("B7").Select
Do
If ActiveCell < nowmonth Then
ActiveCell.Offset(0, 1).Select
End If
Loop Until ActiveCell = nowmonth

ActiveCell.Offset(1, 0).Select


:)


"Louise" wrote:

Hi,

I have some data and the headers for the numbers are months. All the
months
are on row 7. I need to add some code to start looking in row 7 (cell
A7)
and look at each column to locate the relevant date entered in cell A1.

Example: The code needs to look at cell A7, then B7, then C7 etc etc
until
it locates the right value.

How can I do this please?

Thanks,


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
locate a column, sum specific columns to the right of that column Beric Dondarrion Excel Discussion (Misc queries) 3 December 29th 09 01:43 AM
How to locate a cell with dynamic column value Terence C Excel Programming 2 November 5th 09 04:36 AM
Locate data from 1 column in another Shaz Excel Worksheet Functions 2 April 24th 09 02:31 PM
Locate last cell in column Sloth Excel Discussion (Misc queries) 8 January 24th 08 05:36 PM
Locate a specific row or column clara New Users to Excel 2 March 22nd 07 04:45 PM


All times are GMT +1. The time now is 01:44 AM.

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"