LRow of table

Takes2ToTango

Board Regular
Joined
May 23, 2023
Messages
69
Office Version
  1. 365
Platform
  1. Windows
Hi all,

I am running into an issue with populating the lrow of a table with copied data. I have pasted the code below. I am trying to get it to copy the data and then with the sheet 'DateQuery' I want it to paste into the lrow of the table. However, I am either getting data overridden or missing the table completely. I have also tried adding '+ 1' onto the end of the .Row.

VBA Code:
  With ws2
        lRow2 = Cells(Rows.Count, 1).End(xlUp).Row
    'Loop from bottom to top deleting according to value in 1st column
        For iCntr2 = lRow2 To 2 Step -1
        
           If Cells(iCntr2, 6) = "QUERY" Then
            Rows(iCntr2).Copy
                With Sheets("DateQuery")
                 lRow3 = Sheets("DateQuery").Range("A" & Rows.Count).End(xlUp).Row  'Tried + 1 on the end of here but causes it to miss the table
                .Range("A" & lRow3).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
                End With
            Rows(iCntr2).Delete
            End If
        Next
      End With
 
No problem, I decided to ditch the table and keep it as standard lines of data. Works perfectly! Thanks again
 
Upvote 0

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.

Forum statistics

Threads
1,224,823
Messages
6,181,177
Members
453,021
Latest member
Justyna P

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