Mysmatch loop VBA for deleting empty rows in a table

Krypt

New Member
Joined
Apr 17, 2023
Messages
13
Office Version
  1. 365
Platform
  1. Windows
Hello everyone,

Hopefully one of you can relieve me of my 2 small problems.
With looking up and summarising multiple VBA codes, I have generally been able to put something together correctly and it works 90%.
One of my problems is whether it could be possible to modify the formula:
1. indicated in red : to copy only last added value mainsheet("INSCRIPTION BADGES") to Sheets(sheet1) table5 next available row.
Second is the :
2. In black marked - yellow line : to help me with the type mismatch to delete rows in a table.

1726242204498.png


Hopefully this picture is enough to explain my problems.

Many thanks for your help.

Kind regards,
Krypt
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
For the mismatch, you are comparing ListRow to Rows. Perhaps this:

VBA Code:
Set TblRng = wb.ListObjects("Table5")
...
For Each row in TblRng.ListRows
 
Upvote 1
For the mismatch, you are comparing ListRow to Rows. Perhaps this:

VBA Code:
Set TblRng = wb.ListObjects("Table5")
...
For Each row in TblRng.ListRows
Hello dreid1011,

thanks for reply, but it's not working.
Receive a new run-time error 438 -> object doesn't support this property or method.

For Each row in TblRng.ListRows -> on that line is now the error.
 
Upvote 0
Did you remove the ".DataBodyRange" from the Set line two lines above as well?
 
Upvote 0
Did you remove the ".DataBodyRange" from the Set line two lines above as well?
Yes like you mentioned before and removed .DataBodyRange but still is there a error

ws.Range("F6:K" & lr).Copy _
wb.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0)

Set TblRng = wb.ListObjects("Table5")
TblRng.RemoveDuplicates Columns:=1, Header:=xlYes

For Each row In TblRng.ListRows
If Application.WorksheetFunction.CountA(row) = 0 Then
row.Delete
End If
Next row
 
Upvote 0
Unfortunately that was just a guess from what I was able to look up online. Without the file to poke around in, I am unsure what else to try at the moment. If you are able to share the file or a copy of it with sensitive data removed/replaced, I could take a look at it this evening. Through DropBox or another file sharing service.
 
Upvote 1
Unfortunately that was just a guess from what I was able to look up online. Without the file to poke around in, I am unsure what else to try at the moment. If you are able to share the file or a copy of it with sensitive data removed/replaced, I could take a look at it this evening. Through DropBox or another file sharing service.
Hello dreid1011,

i found another solution by changing the code copy-paste to copy pastspecial xlvalues, with this there no need of deleting empty row in the table.
It helped me also for my other issue to simplify the VBA code.

1726381436408.png

Thanks a lot to look for a solution with me.

Have a nice weekend.
Krypt
 
Upvote 0
Solution

Forum statistics

Threads
1,221,528
Messages
6,160,346
Members
451,639
Latest member
Kramb

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