VBA Button to fill in data based off dropdown list value

Colosimo87

New Member
Joined
Oct 1, 2018
Messages
5
I have 10 rows of data with one of the columns called "Type". This column has either "Primary" or "Secondary" entered in. I then have a column at the end called "Provider" that needs to be filled in based off the functions of my "Primary" button. The button essentially will fill in the "Provider" column for all the "Primary" rows with whatever the value is selected in the dropdown list next to the button. The dropdown list has different telecom providers that the user can select. Is this possible at all? I tried a vlookup but unfortunately it only filled in the first cell that was labeled as "Primary" and not all of them.
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
It may help more if you were to tell us column 8 or column 10 not say column Type and
Provider


And you said:
value is selected in the dropdown list next to the button

So how are we to know where the button is?
It would be better to say dropdown list in column B
 
Upvote 0
Sorry, that would make more sense. Column Type is Column 1 and Column Provider is column 4. Not sure why it would matter where the button is but the dropdown list is C16.

Hope this helps!

Thanks.
 
Upvote 0
You also said:
I have 10 rows of data

I assume this means Rows 1 to 10
Is that correct?
 
Upvote 0
This script does this:
When you run this script

The script looks in column A and when it finds the value in Range("C16")
It copies that value from Column A and puts that value in next empty cell in Column D

Hope this is what you wanted.
If not please explain again.
Code:
Sub Check_Provider()
'Modified  10/2/2018  2:07:23 AM  EDT
Dim r As Range
Dim Lastrow As Long
Lastrow = Cells(Rows.Count, "D").End(xlUp).Row + 1
    For Each r In Range("A1:A10")
        If r.Value = Range("C16").Value Then r.Copy Cells(Lastrow, "D"): Lastrow = Lastrow + 1
    Next
End Sub
 
Upvote 0
Back to my original example, they select the provider in C16 and then it should fill in all the rows in Column 1 that say primary and put the name of the provider selected in C16 in the last column. Does this make sense?
 
Upvote 0
No I still have a problem understanding:
You said:
and then it should fill in all the rows in Column 1 that say primary

Fill in the rows with What?

And then you said:
and put the name of the provider selected in C16 in the last column.

Well we are back to not saying what column. I assume you mean column 4


So if the cell in column 1 Says primary fill the cell with the value selected in C16
Is that what you want?




 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,771
Members
452,353
Latest member
strainu

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