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: 1
Default matching values and inputing value in the adjacent cell


Hi,

I posted a question about this last week, but had to remove it becaus
I accidently included some information that I did not want out on th
web. Here is my code.

I am trying to loop through a colum and look for certain criteria. I
the cell meets the criteria, it inserts a value to the adjent cell i
the next column. However, not all the cells in column a have are fille
in fact, a lot of them are empty, but I want the program to loop throug
until the end of the column. Can I just make this an OR statement tha
also include a column that always has data so when both are empt
together, I know it is at the end of the range?

When I run the code, it gives me an error for the "i" in the Next
statement. It also gives me a type mismatch error in the if rows. I ca
get this error to stop if I get rid of the OR statement so I'm thinkin
that is the problem even though it doesn't make sense to me.


Dim a As String
Dim cntr As Integer

'loop through cells to find product and input the corresonding rout
one
'cell to the right

For cntr = 1 To Cells(Rows.Count, "A").End(xlUp).Row
If a = "Product A-1" Or "Product A-2" Then
ActiveCell.Offset(0, 1).Value = "123.6ABC"
ElseIf a = " Product B-0" Or "Product B-1" Then
ActiveCell.Offset(0, 1).Value = "456.6CDE"
ElseIf a = "Product C-1" Then
ActiveCell.Offset(0, 1).Value = "789.1A2BC"
Else
cntr = cntr + 1
End If
Next

--
bundyloc
-----------------------------------------------------------------------
bundyloco's Profile: http://www.excelforum.com/member.php...fo&userid=2338
View this thread: http://www.excelforum.com/showthread.php?threadid=38781

 
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
matching cell values Geofridu Excel Worksheet Functions 2 September 25th 08 06:49 PM
Matching Criteria in adjacent columns frankjh19701 Links and Linking in Excel 13 May 14th 07 05:22 PM
Calculations based on adjacent cell values Jack Excel Discussion (Misc queries) 4 June 10th 06 02:39 PM
Matching Adjacent Columns? gnotnoel via OfficeKB.com Excel Worksheet Functions 4 June 8th 06 01:43 PM
referencing values in adjacent cells to selected cell Darren Haslett Excel Programming 3 February 23rd 04 05:45 PM


All times are GMT +1. The time now is 05:15 AM.

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"