This has been causing problems in several areas of my spreadsheet.
This formula will not work unless the number in column C is preceded by a single quotation mark:
However, the single quotation mark breaks all my code like this:
Here's the formula not working in Column D (no single-quotation preceding the 2 in C2):
Here's the formula working correctly in Column D (with single-quotation preceding the 2 in C2). This works here but breaks the code above:
I've tried formatting the cell as text, formatting general and formatting as a number.
What am I doing wrong?
This formula will not work unless the number in column C is preceded by a single quotation mark:
VBA Code:
=IF(C54="1","",IF(C54="2","Duplex",IF(C54="3","3-Unit",IF(C54="4","4-Unit",IF(C54="5","5-Unit",IF(C54="6","6-Unit",""))))))
However, the single quotation mark breaks all my code like this:
VBA Code:
Private Sub cmdSearchModelCode_Click()
Dim LastRow As Long
ModelCode = Trim(ModelCode.Text)
If Len(ModelCode.Text) = 0 Then Exit Sub
With wsModels
LastRow = .Cells(Rows.Count, 1).End(xlUp).Row
For i = 1 To LastRow
If .Cells(i, 1).Value = ModelCode Then
ModelCode.Text = .Cells(i, 1).Value
ModelName.Text = .Cells(i, 2).Value
ModelUnits.Text = .Cells(i, 3).Value
Me.cmdDeleteModel.Enabled = True
Exit For
End If
Next
End With
End Sub
Here's the formula not working in Column D (no single-quotation preceding the 2 in C2):
Here's the formula working correctly in Column D (with single-quotation preceding the 2 in C2). This works here but breaks the code above:
I've tried formatting the cell as text, formatting general and formatting as a number.
What am I doing wrong?