dim ws as worksheet
dim irow as long
Dim rng as Range
Dim rng1 as Range
set ws= worksheets("Code")
irow=ws.cells(rows.count, 1).end(xlup).offset(1,0).row
set rng = ws.Range(ws.cells(1,1),ws.cells(1,irow - 1))
set rng1 = Application.Find(me.Textbox1.Value)
if not rng is nothing then
msgbox me.Textbox1.Value & " already exists"
Me.Textbox2.Value = rng.offset(0,1)
Me.Textbox3.Value = rng.offset(0,2)
else
ws.cells(irow, 1).value = me.textbox1.value
ws.cells(irow, 2).value = me.textbox2.value
ws.cells(irow,3).value = me.textbox3.value
End if
--
Regards,
Tom Ogilvy
"Syed Haider Ali"
<Syed.Haider.Ali.1wydua_1129395909.0974@excelfor um-nospam.com wrote in
message news:Syed.Haider.Ali.1wydua_1129395909.0974@excelf orum-nospam.com...
Dear Friends.
I have a table with three fields A,B,C. I need the code for if i put
the value in textbox1 it searchs with Col A, if found then rest of
record shown in textbox2 and textbox3. And if it is a new record then
append the sheet.
What codes i am using are these.
dim ws as worksheet
dim irow as long
set ws= worksheets("Code")
irow=ws.cells(rows.count, 1).end(xlup).offset(1,0).row
ws.cells(irow, 1).value = me.textbox1.value
ws.cells(irow, 2).value = me.textbox2.value
ws.cells(irow,3).value = me.textbox3.value
Any suggestion please.
Syed Haider Ali
--
Syed Haider Ali
------------------------------------------------------------------------
Syed Haider Ali's Profile:
http://www.excelforum.com/member.php...o&userid=21994
View this thread: http://www.excelforum.com/showthread...hreadid=476504