Copy Range of Cells to Another Sheet

JayB0730

Board Regular
Joined
Oct 22, 2014
Messages
74
Office Version
  1. 365
Platform
  1. Windows
Hello,

I have two Worksheets; "DataSet" & "SubmitSheet".

DataSet:
This worksheet contains data in columns A:I (Row 1 contains Headers); I want to copy all data residing in cells "A:D" where adjacent cell "I" is blank (starting on Row 2 because of headers). There will be multiple rows and I want to copy every row of data (A:D) where "I" is blank & paste into "SubmitSheet". Please note that I will be running another macro that will enter a date in column "I" after this macro is completed (I already have that script & will call that after this process is run). This way when I add information in the future in columns A:H, I can run this macro again for new information where "I" is blank. Should there be no blank cells in Column I (i.e. dates are already populated), I would like to have a message pop up alerting user that information is up-to-date (I'll update message accordingly)

SubmitSheet:
This sheet will always contain Headers (A:D) that is shown on "DataSet". This sheet should be overwritten with data copied from DataSet each time the Macro is run.

Thank you, in advance, for your help!
Jay
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
How about
Code:
Sub CopyIfColIisBlank()

   Dim Ar As Areas
   Dim Rng As Range
   
   Sheets("SubmitSheet").UsedRange.Offset(1).Clear
   On Error Resume Next
   Set Ar = Sheets("DataSet").Columns(9).SpecialCells(xlBlanks).Areas
   On Error GoTo 0
   If Ar Is Nothing Then
      MsgBox "Nothing to copy"
      Exit Sub
   End If
   For Each Rng In Ar
      Rng.Offset(, -8).Resize(, 4).Copy Sheets("SubmitSheet").Range("A" & Rows.Count).End(xlUp).Offset(1)
   Next Rng
End Sub
 
Upvote 0
Glad to help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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