Thread
:
Cell value not recognized by code.
View Single Post
#
8
Posted to microsoft.public.excel.misc
Sandy Mann
external usenet poster
Posts: 2,345
Cell value not recognized by code.
Sorry Brady but I can't follow exactly what it is you are trying to do and
there seem to be inconsistencies in what you are saying. For example you
say:
I use RowNum in a for/next loop that starts at 1
If RowNum starts at 1 and
(sans the "-SubTotal") is the row above it. Thus, RowNumMin is defined
as RowNum -1.
Then RowNumMin must start off at zero so your code line:
Or Cells(RowNumMin, ColPN).Value = "not inventory" Then
should throw an error because there is no Row zero. Unless you are finding
RowNumMin in a different counting loop.
Do you want to send me a sample of your spreadsheet to see what is going on?
If so change me address as it says below.
--
Regards,
Sandy
Retired from Work
But hopefully not from Life
with @tiscali.co.uk
"Brady" wrote in message
ps.com...
Ha ha...money on this side...surely you jest.
Sandy,
I had put in this code earlier to do exactly what you said:
MsgBox RowNumMin & "' " & ColPN
It displayed the exact row and column I wanted to look in. Now you
see why I'm so perplexed.
I should give more info. Before I do this test and input Pull or
Buy, I've sorted by part number and subtotaled the quantity of each
part. Thus, my list contains part numbers in the part number column AND
just below the last specific part number, a new row with "part number"
- SubTotal (basic Excel stuff).
I use RowNum in a for/next loop that starts at 1 and goes to the
"Lastrow" (found in another sub-routine). Within the for/next loop
there is an if statement that looks for any row with a formula in the
qty (i.e. the subtotal row).
Once I find a subtotal row, I know that the original part number
(sans the "-SubTotal") is the row above it. Thus, RowNumMin is defined
as RowNum -1.
So why can't it "See" the "not inventory"? Drat it all.
Sandy Mann wrote:
Hi Brady,
Nice to meet a fellow Mann.
I traced my family tree back to 1833 - no money in my side of the family,
perhaps it is all on your side <g
I assume that you are indexing RowNum in you For/Next loop. If so how is
RowNumMin being indexed?
When I get into situations like yours I try breaking it down like, if I
know
that I have "not inventory" in Cell E5 I try a piece of test macro like:
Sub Tester()
If UCase(Trim(Cells(5, 5).Value)) = "NOT INVENTORY" Then MsgBox
"Found
it!"
End Sub
If you get the messagebox then you know that you do not have matching
problem so it must be a reference problem. So either RowNumMin or ColPN
must be pointing the code to a different cell
--
HTH
Sandy
Retired from Work
But hopefully not from Life
with @tiscali.co.uk
Reply With Quote
Sandy Mann
View Public Profile
Find all posts by Sandy Mann