editing data in VBA

VBAmalta89

Board Regular
Joined
Mar 25, 2011
Messages
116
I have a worksheet which contains data in rows, i.e each row contains data about a specific item which is then written in the columns

example

23344 Drilling Turning 4 4 3 4
67676 Grinding Polishing 3 3 6 7

This data is entered into the worksheet via a user form from VBA.

I need to create another user form which can allow the user to edit this data. I was thinking of creating one with a drop down box which allows you to see all the components in the worksheet.

My problem is here: how do i tell it to show all teh related information of that particular component?
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
To quote the example i gave, if i want to edit component number 23344, then this is selected from the drop down menu. Then the user form will display the data Drilling Turning 4 4 3 4 in the user form
 
Upvote 0
yes, if possible. Alternatively, the text boxes would be there already but would be blank until the user chooses a component
 
Upvote 0
well.... after you figure out your dropdown menu
I'm using i to represent what you are using for the dropdown value
textbox2 = range("whatever column your first part is in" & i)
textbox3 = range("whatever column your second part is in" & i)
textbox4 = range("whatever column your third part is in" & i)
textbox5= range("whatever column your fourth part is in" & i)
 
Upvote 0
I am getting the data for the different component numbers from an excel worksheet so i cant understand what 'i' is?
 
Upvote 0
use the .listindex of the component number to reference the Row number.


something like

Code:
If ComponentNumber.ListIndex <> -1 Then
textbox2 = Range("B" & ComponentNumber.ListIndex)
textbox3 = Range("C" & ComponentNumber.ListIndex)
 End If

I don't know where your data starts, so you may have to play around with the data a bit to call the right row. For instance it may be that

textbox2 = Range("B" & ComponentNumber.ListIndex + 2)

Just try it on 1 textbox and check until you get it correct. Hope this helps
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,613
Messages
6,179,903
Members
452,948
Latest member
Dupuhini

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top