ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Help with a User Form problem please (https://www.excelbanter.com/excel-programming/313041-help-user-form-problem-please.html)

Peter[_28_]

Help with a User Form problem please
 
Hi,

I have a spreadsheet for which I have created two user forms. The
first user form is used for entering data and writing that data to the
next free row in my spreadsheet.

I want the second user form to select one of the rows that already
contains data (by using the unique identifier in column A) and writing
additional data to empty cells in that row.

I have loaded an example here

http://www.nidum.plus.com/Excelform2.html

Here for example, I would like the second user form to select the row
with the identifier AAA556 and add data to the cells Name 2, Data 3
and Data 4.

I have a combo box that shows the data in column A, but cannot work
out how to then select that row so the data may be written to the
required cells.

Can anyone please point me towards a solution?



--
Cheers

Peter

Remove the INVALID to reply

Bob Phillips[_6_]

Help with a User Form problem please
 
Peter,

The combobox value is obtained using

Combobox1.Value

You can use this value with a worksheet function to find the row

myRow = WorksheetFunction.Match(Combobox1.Value,
Activesheet.Range("A:A"),0)

and then directly load the cells

Activesheet.Cells(myRow,"E").Value = txtName2.Text

etc.

--

HTH

RP

"Peter" wrote in message
...
Hi,

I have a spreadsheet for which I have created two user forms. The
first user form is used for entering data and writing that data to the
next free row in my spreadsheet.

I want the second user form to select one of the rows that already
contains data (by using the unique identifier in column A) and writing
additional data to empty cells in that row.

I have loaded an example here

http://www.nidum.plus.com/Excelform2.html

Here for example, I would like the second user form to select the row
with the identifier AAA556 and add data to the cells Name 2, Data 3
and Data 4.

I have a combo box that shows the data in column A, but cannot work
out how to then select that row so the data may be written to the
required cells.

Can anyone please point me towards a solution?



--
Cheers

Peter

Remove the INVALID to reply




Peter[_28_]

Help with a User Form problem please
 
On Sat, 9 Oct 2004 11:38:02 +0100, "Bob Phillips"
wrote:

Peter,

The combobox value is obtained using

Combobox1.Value

You can use this value with a worksheet function to find the row

myRow = WorksheetFunction.Match(Combobox1.Value,
Activesheet.Range("A:A"),0)

and then directly load the cells

Activesheet.Cells(myRow,"E").Value = txtName2.Text

etc.


many thanks Bob,

It worked like a dream - exactly what I was after


--
Cheers

Peter

Remove the INVALID to reply

Bob Phillips[_6_]

Help with a User Form problem please
 
Good to hear that Peter, and thanks for letting us know.

Bob

"Peter" wrote in message
...
On Sat, 9 Oct 2004 11:38:02 +0100, "Bob Phillips"
wrote:

Peter,

The combobox value is obtained using

Combobox1.Value

You can use this value with a worksheet function to find the row

myRow = WorksheetFunction.Match(Combobox1.Value,
Activesheet.Range("A:A"),0)

and then directly load the cells

Activesheet.Cells(myRow,"E").Value = txtName2.Text

etc.


many thanks Bob,

It worked like a dream - exactly what I was after


--
Cheers

Peter

Remove the INVALID to reply





All times are GMT +1. The time now is 12:14 AM.

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