running a macro if a set value is present and...

lrussell5

New Member
Joined
Aug 19, 2013
Messages
11
Hi All

I think I have a new one, have searched this forum far and wide.. Any help would be highly appreciated!

What I am trying to achieve is for a preset range of data to be copied into a column depending on the value selected from a drop down box.

The below screen shots will hopefully show what I am hoping to achieve (better than I could word).

If possible the forumla/macro would run when a value is selected from the 'No. Colours' drop down, and whatever the number selected will multiply the number of times the range of data is copied over (see the last image)

4.jpg
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Well, if you'd like the macro to run automatically, you can right click the tab, select "View Code" and paste this:

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
 
    If Target.Address = "$O$2" Then
        UpdateInfo  
End If
 
End Sub

As for getting the actual data, you'd need to create a macro named UpdateInfo that will have if statements to specify where data should be copied from and based on what conditions.
 
Upvote 0
Thanks for your help VorLag,

I'm afraid I don't quite folow

Where did "$O$2" come from?

I need a macro to run depending on what values are present in D3, i.e.

IF D3 = 1 Then
Updateinfo1
IF D3 = 2 Then
Updateinfo2
IF D3 = 3 Then
Updateinfo3

Could I then program each 'Updateinfo' macro to return the required set of data?

Perhaps a combo box would be a better solution?

Thanks
Lloyd
 
Upvote 0

Forum statistics

Threads
1,215,109
Messages
6,123,136
Members
449,098
Latest member
Doanvanhieu

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