Autocopy row based on whether the cell in a certain column is

Closed
crystal hill - Nov 30, 2015 at 09:02 AM
TrowaD
Posts
2880
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
May 2, 2022
- Dec 1, 2015 at 11:08 AM
Hello,

I have a detailed aging report that I am attempting to create monthly tabs in. Basically what I need is a macro that will auto paste the entire row into another sheet in the same workbook based on whether the cell in said column are blank.

I can forward the workbook to you for reference if you need me to.


thanks
crystal


2 replies

TrowaD
Posts
2880
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
May 2, 2022
509
Nov 30, 2015 at 11:39 AM
Hi Crystal,

Adjust the code below to match situation:
Code line 5: This is the sheet with all the data.
Code line 6: This is the column with possible blanks.
Code line 7: This is the destiantion sheet where the rows with blank are copied to.

Sub RunMe()
Dim Col_W_Blanks As Integer
Dim MySheet As Worksheet

Sheets("Sheet1").Select
Col_W_Blanks = Columns("B").Column - 1
Set MySheet = Sheets("Sheet2")

For Each cell In Range("A2:A" & Cells(Rows.Count, "A").End(xlUp).Row)
    If cell.Offset(0, Col_W_Blanks) = vbNullString Then
        cell.EntireRow.Copy MySheet.Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
    End If
Next cell

End Sub


Best regards,
Trowa
0
crystalhill
Posts
1
Registration date
Monday November 30, 2015
Status
Member
Last seen
November 30, 2015

Nov 30, 2015 at 04:14 PM
I sent back my workbook via email and what I am attempting is to copy/paste all the cell under each month into the month labeled tabs
0
TrowaD
Posts
2880
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
May 2, 2022
509
Dec 1, 2015 at 11:08 AM
You can upload your workbook to a free file sharing site like www.speedyshare.com or ge.tt and post back the download link. Always be careful with sensitive information.
0