ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Display of Record Set (https://www.excelbanter.com/excel-programming/342916-display-record-set.html)

Syed Haider Ali[_26_]

Display of Record Set
 

Dear Friends.

I have a table with three fields A,B,C. I need the code for if i pu
the value in textbox1 it searchs with Col A, if found then rest o
record shown in textbox2 and textbox3. And if it is a new record the
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 Al

--
Syed Haider Al
-----------------------------------------------------------------------
Syed Haider Ali's Profile: http://www.excelforum.com/member.php...fo&userid=2199
View this thread: http://www.excelforum.com/showthread.php?threadid=47650


Tom Ogilvy

Display of Record Set
 
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




Syed Haider Ali[_27_]

Display of Record Set
 

Thanks Tom Ogilvy.


--
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


Syed Haider Ali[_28_]

Display of Record Set
 

Dear Tom Ogilvy,

An error "Run time error 1004" is appearing at

"set rng1=application.find(me.textbox1.value)"

Please Solve this one

Thanks

Syed Haider Al

--
Syed Haider Al
-----------------------------------------------------------------------
Syed Haider Ali's Profile: http://www.excelforum.com/member.php...fo&userid=2199
View this thread: http://www.excelforum.com/showthread.php?threadid=47650



All times are GMT +1. The time now is 05:01 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com