View Single Post
  #16   Report Post  
Posted to microsoft.public.excel.programming
shelfish shelfish is offline
external usenet poster
 
Posts: 39
Default Failed Comparison... why?

On Dec 5, 3:14 pm, Mark Lincoln wrote:
I forgot to ask: How is your macro code generating the contents of
B1? Cell B1 looks to be the prime suspect since you can re-enter the
same figure into it to make the formula work. That leads to the macro
code. I would at least like to see the concatenation portion of the
code, the values (variables) it is using, and where those values come
from.


I did a lot of copy and pasting so ignore minor syntax errors...it
works just fine except for stated problem.

Here ya go...

SET VALUES
Range("d2").Select
Serial = ActiveCell.Value
Range("c2").Select
Model = ActiveCell.Value

'NO BLANKS... "" MEANS EOF
Do
If ActiveCell.Value = "" Then
Exit Do
Else
'LOTS OF IF/ELSE STATEMENTS OMITTED.
If Model = "182T" Then
ActiveCell.Offset(0, -1).Activate
ActiveCell.Value = "182" & Serial
ActiveCell.Offset(1, 2).Activate
Serial = ActiveCell.Value
ActiveCell.Offset(0, -1).Activate
Model = ActiveCell.Value
End if
Loop
Range("a2").Select
With Worksheets("sheet1l")
Set y = .Range("A2", _
.Cells(.Range("D2").End(xlDown).Row, 1))
End With
Range("a2").Select
'UNIT IS A NAMED RANGE ON SHEET 1
ActiveCell.Formula = "=IF(ISERROR(MATCH(B2,unit,0)),""x"",B2)"
Selection.AutoFill Destination:=y
ActiveCell.Value = "182" & Serial
ActiveCell.Offset(1, 2).Activate
Serial = ActiveCell.Value
ActiveCell.Offset(0, -1).Activate
Model = ActiveCell.Value
'DELETE ALL "X"s (UNITS NOT IN COMMON)