Quicker way to copy cell values from fixed row into selected row in multiple cells?

danbates

Active Member
Joined
Oct 8, 2017
Messages
377
Office Version
  1. 2016
Platform
  1. Windows
Hi,

I have the following code that works but I was wondering if anyone knows a quicker way to code it?

Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)'DAYS


If Target.Column = 3 Then


Application.ScreenUpdating = False


Range("C" & Selection.Row).Value = Range("C6").Value
Range("D" & Selection.Row).Value = Range("D6").Value
Range("E" & Selection.Row).Value = Range("E6").Value
Range("F" & Selection.Row).Value = Range("F6").Value
Range("G" & Selection.Row).Value = Range("G6").Value
Range("H" & Selection.Row).Value = Range("H6").Value
Range("I" & Selection.Row).Value = Range("I6").Value
Range("J" & Selection.Row).Value = Range("J6").Value
Range("K" & Selection.Row).Value = Range("K6").Value
Range("L" & Selection.Row).Value = Range("L6").Value
Range("M" & Selection.Row).Value = Range("M6").Value
Range("N" & Selection.Row).Value = Range("N6").Value
Range("O" & Selection.Row).Value = Range("O6").Value
Range("P" & Selection.Row).Value = Range("P6").Value
Range("Q" & Selection.Row).Value = Range("Q6").Value
Range("R" & Selection.Row).Value = Range("R6").Value
Range("AM" & Selection.Row).Value = Range("AM6").Value
Range("AN" & Selection.Row).Value = Range("AN6").Value
Range("AO" & Selection.Row).Value = Range("AO6").Value
Range("AP" & Selection.Row).Value = Range("AP6").Value
Range("AQ" & Selection.Row).Value = Range("AQ6").Value
Range("AR" & Selection.Row).Value = Range("AR6").Value
Range("AS" & Selection.Row).Value = Range("AS6").Value


Range("AV" & Selection.Row).Select


End If


Application.ScreenUpdating = True


End Sub

Thanks

Dan
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
How about
Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) 'DAYS


If Target.Column = 3 Then


Application.ScreenUpdating = False


Range("C" & Selection.Row).Resize(, 16).Value = Range("C6:R6").Value
Range("AM" & Selection.Row).Resize(, 7).Value = Range("AM6:AS6").Value
Range("AV" & Selection.Row).Select


End If


Application.ScreenUpdating = True


End Sub
 
Upvote 0
Hi Fluff,

That is perfect and so much quicker.

Thank you Fluff.

Regards

Dan
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,223,231
Messages
6,170,884
Members
452,364
Latest member
springate

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