LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default Match, then Look Left 4 Columns, then Loop to End of Range

I have some VBA code, part of which uses an InputBox to get the number of the
month (for instance, now it is 11) from a user. Result goes into B1. Months
are listed in Range C4:T4 (includes a few additional items). So i have a
simple function that gets the column that matches the month: =MATCH(B1,C4:T4)

I am trying to come up with a function that goes to this column; in this
case Column Q is November. Next month the column would be R; the Match
function above handles this. Then, the function looks in the range like
Offset(-4, 0) and figures out if all of these are zero. If all four cells to
the left of the current month are zero, I want to put something in the
current cell like "None".

Finally, I need code that finds the end of the used range, in column T, and
then copies the function that was created above, down that number of rows.
Something such as this may work:

Dim lastrow As Long
lastrow = ActiveSheet.Cells(Rows.Count, "T").End(xlUp).Row
Range("U5:U" & lastrow).Select
Selection.FormulaR1C1 = ...function above...

Please help!
Deadline looms...


Thanks,
Ryan---



--
RyGuy
 
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
MATCH from right to left Werner Rohrmoser Excel Worksheet Functions 7 April 5th 23 02:55 PM
scroll so that the upper left cell in a range moves to the upper left of the active window Andre[_6_] Excel Programming 6 November 14th 08 09:33 PM
Shift constant values in a range left or right by n columns Dirk Goldgar Excel Programming 2 July 21st 08 07:09 PM
Loop Until Desired Columns left SteveT Excel Programming 3 November 29th 07 11:22 PM
VLOOKUP and LEFT to match text? LTUser54 Excel Worksheet Functions 6 May 23rd 06 08:33 PM


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