tables vs cells

BobtBuilder

New Member
Joined
Sep 1, 2023
Messages
45
Office Version
  1. 365
Platform
  1. Windows
First I would like to thank everyone who has helped me with this project. I hope this is the last item. (and we know how that usually works out)

I am having an issue with filtering and copying data. I have check all fields they are they same, I have this code running on another sheet and it runs fine.

Sub Reconcile_LoadNew()
With Dashboard
If .Range("K3").Value = Empty Or .Range("O3").Value = Empty Then
MsgBox "Please make sure to add in an Account and Statement Date before loading transactions"
Exit Sub
End If
.Range("I11:P9999").ClearContents
End With

' Set the target cell (N3 in this case) for the active sheet
Set TargetCell = Dashboard.Range("K3")

' Get the value from the target cell
WSName = TargetCell.Value

' Set the source worksheet
Set ws = ThisWorkbook.Sheets(WSName) ' Change "Sheet1" to your source sheet name

With ws
LastTransRow = .Range("A99999").End(xlUp).Row 'Last Trans Row
If LastTransRow < 3 Then Exit Sub
-> .Range("A2:K" & LastTransRow).AdvancedFilter xlFilterCopy, CriteriaRange:=.Range("O2:R3"), CopyToRange:=.Range("T2:AB2"), Unique:=True
LastResultRow = .Range("U99999").End(xlUp).Row 'Last Result Row
If LastResultRow < 3 Then Exit Sub 'Check Last Result row
Dashboard.Range("I11:P" & LastResultRow + 8).Value = .Range("T3:AB" & LastResultRow).Value 'Bring over transactions
Dashboard.Range("I10").Value = Chr(168)
End With
End Sub

I keep getting Run time error '1004':
The extract range has missing or invalid field name
The only thing that I can see is that on the new sheet the filtering and extraction is done in a table vs just plain cells
I have dim ed all the variables.
I am using 365

Thank you so much
 

Attachments

  • excel 110123 screeb.png
    excel 110123 screeb.png
    44.2 KB · Views: 7

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
There you have 11 columns.


There you only have 9 columns.

Then change to this:
Rich (BB code):
CopyToRange:=.Range("T2:AD2")

Regards
Dante Amor
😇
Hi Dante, thanks for the response, but still getting same error. Its weird because on another workbook it works fine.
 
Upvote 0
CopyToRange:=.Range("T2:AD2")

Before running the macro, delete the contents of cells T2:AD2

Try again.
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

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