• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

VBA to update and remove empty rows

Jet Fusion

Member
Hi

Please can someone assist.

I am trying to make sheet2 update from sheet1 that when sheet1 updates to either yes or no -
yes = it will show on sheet2
no = will not show on sheet2

It's updating but showing empty rows which I do not want but also sheet2 needs to update whenever sheet1 does have info changed

So if I enter on sheet1 yes for all then all should show but if some have yes and some no then it should only show the yes info but also if I add any other or change from yes to no it should automatically update the info on sheet2 with no empty rows even if sheet1 has empty rows.

Thank you
:)
 

Attachments

  • Test Blank.xlsx
    13.5 KB · Views: 6
Hello, according to the attachment a VBA event procedure to paste only to the Sheet2 worksheet module :​
Code:
Private Sub Worksheet_Activate()
        UsedRange.Clear
   With Sheet1
       .[A1,G1:H1].Copy [A1]
       .[Z2].Formula = "=J2=""Yes"""
       .UsedRange.AdvancedFilter 2, .[Z1:Z2], [A1:C1]
       .[Z2].Clear
   End With
End Sub
Do you like it ? So thanks to click on bottom right Like !​
 
Hi @p45cal and @Marc L

I tried out the above and for -

@p45cal - I get #Value error = I may have put it in wrong :confused:

@Marc L - It worked in the temp file but not in my workbook. Also, I have other info on my worksheet that I do not want cleared can your VBA perhaps work the same but only copy and update the info and not clear the sheet2 when copied. I don't need the A1 you reference in your code

I copied the rows in the same place as my workbook due to sensitive info I can't share the exact file.

In the attached updated file I'm only looking at the info on sheet1 G4:H500 to show on Sheet2 but then to update as per original post. @Marc L I have your code in the file.

Thanks :)
 

Attachments

  • Blank Test.xlsm
    12.3 KB · Views: 6
@p45cal Thank you that worked :awesome:

The only thing I forgot to mention :oops: in my worksheet that column D & E are merged as per last attached file when I use the formula it gives a spill and shows the spill column D but if I unmerge it works perfectly.

Is there a way to have it so that I can still keep the two cells merged :)

1726552790649.png

Thank you again.
 
It worked in the temp file but not in my workbook.
As guessing can't be coding, if you are not able to fit any help to your real workbook then​
such attachment not reflecting exactly the real workbook is a no sense, just a time waste …​
According to your post #5 attachment the revamped VBA event procedure :​
Code:
Private Sub Worksheet_Activate()
        [B3].CurrentRegion.Offset(1).Clear
   With Sheet1
       .[Z2].Formula = "=K4=""Yes"""
       .[B3].CurrentRegion.AdvancedFilter 2, .[Z1:Z2], [B3:D3]
       .[Z2].Clear
   End With
End Sub
You may Like it !​
 
As guessing can't be coding, if you are not able to fit any help to your real workbook then​
such attachment not reflecting exactly the real workbook is a no sense, just a time waste …​
According to your post #5 attachment the revamped VBA event procedure :​
Code:
Private Sub Worksheet_Activate()
        [B3].CurrentRegion.Offset(1).Clear
   With Sheet1
       .[Z2].Formula = "=K4=""Yes"""
       .[B3].CurrentRegion.AdvancedFilter 2, .[Z1:Z2], [B3:D3]
       .[Z2].Clear
   End With
End Sub
You may Like it !​
Thank you and sorry for wasting your time...
 
Back
Top