Copying Completed Fields and Pasting Into Next Blank Row

HomeTek

New Member
Joined
Jan 27, 2017
Messages
42
Office Version
  1. 365
Platform
  1. Windows
Hi,

I'm having a bit of trouble with this, which I thought would be fairly simply. But apparently not simple for me if anyone can help please?

I have a worksheet like below...

zeFZXi.jpg


And when I press the macro I want it to transfer the data above to populate another worksheet so it looks like the below...

GfpOJj.jpg



As you can see. It copies any rows from the first sheet that have a time entered and pastes them into the second sheet into the next available row and also adds today's date.

Many thanks
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Try this
Change the data in blue for the names of your sheets

Code:
Sub Copying_Completed_Fields()
  Dim sh1 As Worksheet, sh2 As Worksheet, lr As Long
  Set sh1 = Sheets("[COLOR=#0000ff]Sheet1[/COLOR]")
  Set sh2 = Sheets("[COLOR=#0000ff]Sheet2[/COLOR]")
  Application.ScreenUpdating = False
  If sh1.AutoFilterMode Then sh1.AutoFilterMode = False
  sh1.Range("A1:B" & sh1.Range("A" & Rows.Count).End(xlUp).Row).AutoFilter 2, "<>"
  sh1.AutoFilter.Range.Offset(1).Copy
  lr = sh2.Range("A" & Rows.Count).End(xlUp).Row + 1
  sh2.Range("B" & lr).PasteSpecial xlPasteValues
  sh2.Range("A" & lr & ":A" & sh2.Range("B" & Rows.Count).End(xlUp).Row).Value = Date
  If sh1.AutoFilterMode Then sh1.AutoFilterMode = False
  Application.CutCopyMode = False
End Sub
 
Upvote 0
Try this
Change the data in blue for the names of your sheets

Code:
Sub Copying_Completed_Fields()
  Dim sh1 As Worksheet, sh2 As Worksheet, lr As Long
  Set sh1 = Sheets("[COLOR=#0000ff]Sheet1[/COLOR]")
  Set sh2 = Sheets("[COLOR=#0000ff]Sheet2[/COLOR]")
  Application.ScreenUpdating = False
  If sh1.AutoFilterMode Then sh1.AutoFilterMode = False
  sh1.Range("A1:B" & sh1.Range("A" & Rows.Count).End(xlUp).Row).AutoFilter 2, "<>"
  sh1.AutoFilter.Range.Offset(1).Copy
  lr = sh2.Range("A" & Rows.Count).End(xlUp).Row + 1
  sh2.Range("B" & lr).PasteSpecial xlPasteValues
  sh2.Range("A" & lr & ":A" & sh2.Range("B" & Rows.Count).End(xlUp).Row).Value = Date
  If sh1.AutoFilterMode Then sh1.AutoFilterMode = False
  Application.CutCopyMode = False
End Sub

Thanks for this. I'm not sure why I found it so difficult, but I can use this as a starting point and tweak it for my use.
 
Upvote 0

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

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