Need a way to copy and paste previous rows after a dropdown selection is made on the same sheet

strlok

New Member
Joined
Dec 5, 2024
Messages
6
Office Version
  1. 365
Platform
  1. Windows
Hello, I think I need to use a Worksheet Change macro but I am not entirely sure. What I'm looking to do is simple. When someone selects a value from the dropdown in cell C5, I need it to copy and paste rows 1 to 10 to row 13. But I need this to occur indefinitely as long as any value in the "USER ID" dropdown is selected so I can have multiple of the same row.

1) Here is what my spreadsheet looks like

1733427003066.png


2) Here is what happens when I select a value in the dropdown of C5

1733427259106.png


3) But what I want after a value is selected in C5 I want it to copy and paste that whole section and provide a blank one (with all the formulas) like this:

1733427309091.png


And then if a value is selected in cell C17, it copies and pastes in row 25, and so forth. I need this to be indefinite.

Just not sure how to create the macro to get this to work.

Thank you for the help.
 
In your hidden rows put a space in the last row of yellow cells. I suspect it’s not finding the last row because they’re just colored with no values.
Thank you, this fixed it.

Is there a way I can just target the "UserId" dropdown cell to create a new template beneath instead of the range "C:C"? Reason being is that I don't want a new template to be created if any other cell in that column has information in it.
 
Upvote 0

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
It is hard to work with pictures. It would be easier to help if you could use the XL2BB add-in (icon in the menu) to attach the desired selected range (not a picture) of your data. Alternately, you could upload a copy of your file (de-sensitized if necessary) to a free site such as www.box.com or www.dropbox.com. Once you do that, mark it for 'Sharing' and you will be given a link to the file that you can post here.
I'm sorry about that. I will keep this in mind for the future. Thank you for telling me this.
 
Upvote 0
Thank you, this fixed it.

Is there a way I can just target the "UserId" dropdown cell to create a new template beneath instead of the range "C:C"? Reason being is that I don't want a new template to be created if any other cell in that column has information in it.
There's likely a better way, but give this a try.
VBA Code:
Private Sub worksheet_change(ByVal target As Range)
If target.CountLarge > 1 Then Exit Sub
Dim lrow As Long
Dim x

If Not Intersect(target, Range("C:C")) Is Nothing Then
On Error GoTo BypassCopyRange
x = target.Validation.Formula1

Application.EnableEvents = False

'find last row
lrow = Sheet1.Cells.Find("*", searchorder:=xlByRows, searchdirection:=xlPrevious).Row + 2

'copy hidden range.  Paste after last row.
Range("1:10").EntireRow.Hidden = False
Range("1:10").Copy Destination:=Range("A" & lrow)
Range("1:10").EntireRow.Hidden = True

Application.EnableEvents = True
End If
BypassCopyRange:
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,518
Messages
6,179,254
Members
452,900
Latest member
LisaGo

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