Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
locate a column, sum specific columns to the right of that column | Excel Discussion (Misc queries) | |||
How to locate a cell with dynamic column value | Excel Programming | |||
Locate data from 1 column in another | Excel Worksheet Functions | |||
Locate last cell in column | Excel Discussion (Misc queries) | |||
Locate a specific row or column | New Users to Excel |