hmk
Active Member
- Joined
- Jun 8, 2004
- Messages
- 423
hi there
when excution get to this level
then it gives me Method Range of Object Worksheet Failed
any idea why ?
The whole code is :
when excution get to this level
Code:
With ws
.Range(r & Exp).Value = tot.Value
.Cells(r & Exp) = tot.Value
End With
any idea why ?
The whole code is :
Code:
Private Sub cmdAdd_Click()
Dim r As Long, Exp As Long
Dim ws As Worksheet
Set ws = Worksheets("sheet2")
r = ws.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
'Exp Name
Exp = ThisWorkbook.Sheets(2).Cells.Find(what:=ComboBox1.Value, _
LookIn:=xlValues, LookAt:=xlPart, SearchOrder:=xlByColumns, _SearchDirection:=xlNext).Column
With ws
.Range(r & Exp).Value = tot.Value
.Cells(r & Exp) = tot.Value
End With
DocNo.Value = ""
ComboBox1.Value = ""
tot.Value = ""
Unload Me
End Sub