Code Does not Realise equal values

hmk

Active Member
Joined
Jun 8, 2004
Messages
423
Hi there
The problem with this line : the code does realise that TextBox2.Value realy equal ws.Range("A65536").End(xlUp).Value.......why is that ?? any idea

Code:
If TextBox2.Value = ws.Range("A65536").End(xlUp).Value Then
ws.Cells(r, Exp) = TextBox1.Value

Code:
Private Sub CommandButton1_Click()
Dim r As Long, Exp As Long
    Dim ws As Worksheet
        
Set ws = Worksheets("sheet1")
r = ws.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row

'*Exp Name
Exp = ThisWorkbook.Sheets(1).Cells.Find(what:=TextBox1.Value, _
                        LookIn:=xlValues, LookAt:=xlPart, _
                        SearchOrder:=xlByColumns, SearchDirection:=xlNext).Column

If TextBox2.Value = ws.Range("A65536").End(xlUp).Value Then
ws.Cells(r, Exp) = TextBox1.Value
Else
With ws
.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0) = TextBox2.Value
.Cells(r, Exp) = TextBox1.Value
End With
End If

End Sub
 

Some videos you may like

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number

hmk

Active Member
Joined
Jun 8, 2004
Messages
423
The problem is solved

Code:
If Val(TextBox2.Text) = ws.Range("A65536").End(xlUp).Value Then
ws.Cells(r - 1, Exp) = TextBox1.Value
 

Watch MrExcel Video

Forum statistics

Threads
1,122,295
Messages
5,595,294
Members
413,984
Latest member
stikpet

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top