LRow of table

Takes2ToTango

Board Regular
Joined
May 23, 2023
Messages
55
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

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.

Forum statistics

Threads
1,215,071
Messages
6,122,964
Members
449,094
Latest member
Anshu121

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