BobtBuilder
New Member
- Joined
- Sep 1, 2023
- Messages
- 45
- Office Version
- 365
- Platform
- 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
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