Demosassiner

New Member
Joined
Aug 13, 2017
Messages
7
To be honest, I don't even know how to explain this fully in words, hoping the table will illustrate the dilemma.

I have a data validation list in column F, with the appropriate selection made in cell E2 e.g. "white" in table 1.


Table 1
ABCDEF
1MicroMICRData Validation List
2Apple123AAPLWhiteBlack
3Fbook1FBBCWhite
4FbuckeydFACEBoth

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>


I need to populate column A with the appropriate selection from the data validation list, which is "white" as shown in table 2.

Table 2
ABCDEF
8WhiteMicroMICRWhiteBlack
9WhiteApple123AAPLWhite
10WhiteFbook1FBBCBoth
11WhiteFbuckeydFACE

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>


I need to use a script to say that, if "both" is selected, populate "black" AND "white" in table A by copy-pasting the B and C selection downwards, and then proceeding to add the terms to the A column such as is shown below.

Table 3
ABCDEF
14BlackMicroMICRBothBlack
15BlackApple123AAPLWhite
16BlackFbook1FBBCBoth
17BlackFbuckeydFACE
18WhiteBlackMICR
19WhiteApple123AAPL
20WhiteFbook1FBBC
21WhiteFbuckeydFACE

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>



Hope this is somewhat clear.
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
OMG I accidentally posted this before I was finished and I can't even find how to edit or delete the thread..
 
Upvote 0
.. and I can't even find how to edit or delete the thread..
You cannot delete a thread. Once you have been around for a while and established yourself as a legitimate forum member (that is, not a spammer) you will have 10 minutes after posting to edit it. Once you are eligible, an "Edit Post" should appear at the bottom right of your post for 10 minutes.

You could try this on a copy of your workbook.
1. Right click the sheet name tab and choose "View Code".
2. Copy and Paste the code below into the main right hand pane that opens at step 1.
3. Close the Visual Basic window & test by selecting a value in E2.
4. Your workbook will need to be saved as a macro-enabled workbook (*.xlsm).

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
  If Not Intersect(Target, Range("E2")) Is Nothing Then
    Application.EnableEvents = False
    Select Case Range("E2").Value
      Case ""
      Case "Both"
        With Range("B1", Range("C" & Rows.Count).End(xlUp))
          .Offset(, -1).Resize(, 1).Value = Range("F2").Value
          .Offset(.Rows.Count, -1).Resize(, 1).Value = Range("F3").Value
          .Offset(.Rows.Count).Value = .Value
        End With
      Case Else
        Range("A1:A" & Range("B" & Rows.Count).End(xlUp).Row).Value = Range("E2").Value
    End Select
    Application.EnableEvents = True
  End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,990
Messages
6,122,625
Members
449,093
Latest member
catterz66

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