ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Userform to grab,correct and restore data (https://www.excelbanter.com/excel-programming/373795-userform-grab-correct-restore-data.html)

jimapos[_2_]

Userform to grab,correct and restore data
 
Hi all
I have a userform that stores data (1 row record with 20 columns) to a
worksheet.Is there a way to grab the data back in (other or the
same)userform, ambent(correct) data and store them back in the same row
in the worksheet?
An example or code will be appreciated.Thanks anyway for your
attension... or help.

P.S. The userform contains 20 textboxes and 1-2 listboxes..


Dave Peterson

Userform to grab,correct and restore data
 
Can you pick out a key column that contains the unique key for that row?

then you could look at that column, look for a match with one of your textbox
values, and determine the row.

dim res as variant
dim myRng as range

with worksheets("sheetnamehere")
set myrng = .range("a1", .cells(.rows.count,"A").end(xlup))
res = application.match(me.textbox1.value, myrng, 0)
if iserror(res) then
'no match, new record to add????
else
msgbox "match was found in row: " & res
with myrng(res)
.offset(0,1).value = me.textbox2.value
.offset(0,2).value = me......
end with
end if

(Untested, uncompiled)


jimapos wrote:

Hi all
I have a userform that stores data (1 row record with 20 columns) to a
worksheet.Is there a way to grab the data back in (other or the
same)userform, ambent(correct) data and store them back in the same row
in the worksheet?
An example or code will be appreciated.Thanks anyway for your
attension... or help.

P.S. The userform contains 20 textboxes and 1-2 listboxes..


--

Dave Peterson


All times are GMT +1. The time now is 02:12 PM.

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