Is this possible??

JimmieNeu

New Member
Joined
Oct 22, 2018
Messages
28
Office Version
  1. 365
Platform
  1. Windows
I am creating a spreadsheet where I have created a drop down cell that contains a set list of options. Once this cell is filled out from the drop down list I have been copy-pasting from another worksheet within the same workbook. I imagine this task is possible with some sort of excel wizardry that I do not posses. Can anyone here help me?

Lets say cell F2 contains the drop down and cells A3:E4 are what are being copied from the other worksheet.

Thank you for your time!
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Can you teach me how this works??
I might be asking to much... if I am, please let me know.


I am attempting to do something simlar for another worksheet, so I copied and pasted your code for this sheet as well. At first it did not work, but then I was able to figure out that I needed to change the column from J to G. However, I only need one column after B to be copied over, not as many as list time. I attempted to figure out how to stop the extra columns from being copied over by deleting lines, but I get errors.
 
Upvote 0
Not quite sure why you need the formula in K:N when they are already in C:F, but this worksheet change code should copy the C:F cells and paste into K:N.
Test with a copy of your workbook. To implement ..
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.
4. Your workbook will need to be saved as a macro-enabled workbook (*.xlsm).

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
  Dim Changed As Range, c As Range, cFound As Range
  Dim s As String
  
  Set Changed = Intersect(Target, Columns("J"))
  If Not Changed Is Nothing Then
    Application.EnableEvents = False
    For Each c In Changed
      s = c.Value
      If Len(s) Then
        Set cFound = Columns("B").Find(What:=s, LookIn:=xlValues, LookAt:=xlWhole, MatchCase:=False)
        If cFound Is Nothing Then
          c.Offset(, 1).Resize(, 4).ClearContents
        Else
          cFound.Offset(, 1).Resize(, 4).Copy Destination:=c.Offset(, 1)
        End If
      Else
        c.Offset(, 1).Resize(, 4).ClearContents
      End If
    Next c
    Application.EnableEvents = True
  End If
End Sub

Can you teach me how this works?
I see where I can change the column, but I do not see where it is copying the information from one cell to the other.
 
Upvote 0
I'm sorry, I haven't been able to spend time on the forum for a while and that will continue for a while longer.
 
Upvote 0

Forum statistics

Threads
1,215,425
Messages
6,124,822
Members
449,190
Latest member
rscraig11

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