ItalianPlatinum
Well-known Member
- Joined
- Mar 23, 2017
- Messages
- 894
- Office Version
- 365
- 2019
- Platform
- Windows
My problem statement: I have code that extracts from a core database. That system has a limit for its filter of 750 characters. So looking for a way to 1) check if the limit is breached and then 2) if breached two split it into multiple iterations so its below the limit. For example:
s would look like this 123456789:987654321:987654111 and etc. unique identifier (9 characters) each separated by a " : "
s would look like this 123456789:987654321:987654111 and etc. unique identifier (9 characters) each separated by a " : "
VBA Code:
'get the string for filter
With Sheets("Data")
s = Join(Application.Transpose(.Range("B11", .Range("B" & rows.count).End(xlUp)).Value), ":")
End With
'apply the strings to prep for extraction
With Sheets("Extract System")
.Activate
.AutoFilterMode = False
.Range("DATE") = RUNDATE4
.Range("VW") = "1"
.Range("Filter") = "C"
.Range("Operation") = "="
.Range("VALUE") = s 'ensure the 750 character isn't breached
End With
'extract from the system and copy data over to the main sheet
Application.Run "'Unpriced.xlsm'!Distribution2" '
With Sheets("Extract System")
rws = .Range("A11:B11").End(xlDown).row - 10
Sheets("MAIN").Range("I8").Resize(rws, 2).Value = .Range("A11:B11").Resize(rws).Value
End With