ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Searching Problem (https://www.excelbanter.com/excel-programming/314525-searching-problem.html)

AndrewAK[_5_]

Searching Problem
 

I'm building an Excel spreedsheet to keep track of items. The code work
great, but I can't search the existing item numbers to see if the ite
is already listed. Ideally, I'd like to enter the Item number, have th
code select the matching item number and update the inventory of tha
item.

Here is the code as it stands. The code is part of a Command Button.

private sub cmdok_click()

activeworkbook.sheets(\"rid sheet\").activate
range(\"a2\").select

do
if isempty(activecell) = false then

activecell.offset(1, 0).select

end if
loop until isempty(activecell) = true

activecell.value = txtdnum.value
activecell.offset(0, 1) = cbodescription.value
activecell.offset(0, 2) = txtcount.value
activecell.offset(0, 3) = txtserialnum.value
range(\"a2\").select
end su

--
AndrewA
-----------------------------------------------------------------------
AndrewAK's Profile: http://www.excelforum.com/member.php...fo&userid=1554
View this thread: http://www.excelforum.com/showthread.php?threadid=27187


Patrick Molloy[_4_]

Searching Problem
 
private sub cmdok_click()
dim target as range
set range = worksheets("rid
sheet").range(\"a2\").end(xldown).offset(1,0)
with target
.value = txtdnum.value
.offset(0, 1) = cbodescription.value
.offset(0, 2) = txtcount.value
.offset(0, 3) = txtserialnum.value
end with
end sub


--
Patrick Molloy
Microsoft Excel MVP
---------------------------------
I Feel Great!
---------------------------------
"AndrewAK" wrote in message
...

I'm building an Excel spreedsheet to keep track of items. The code works
great, but I can't search the existing item numbers to see if the item
is already listed. Ideally, I'd like to enter the Item number, have the
code select the matching item number and update the inventory of that
item.

Here is the code as it stands. The code is part of a Command Button.

private sub cmdok_click()

activeworkbook.sheets(\"rid sheet\").activate
range(\"a2\").select

do
if isempty(activecell) = false then

activecell.offset(1, 0).select

end if
loop until isempty(activecell) = true

activecell.value = txtdnum.value
activecell.offset(0, 1) = cbodescription.value
activecell.offset(0, 2) = txtcount.value
activecell.offset(0, 3) = txtserialnum.value
range(\"a2\").select
end sub


--
AndrewAK
------------------------------------------------------------------------
AndrewAK's Profile:
http://www.excelforum.com/member.php...o&userid=15546
View this thread: http://www.excelforum.com/showthread...hreadid=271879





All times are GMT +1. The time now is 10:00 PM.

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