Hey,
What I am trying to do is search a large database for certain data and paste that particular data to another sheet. So, a lot of non-contiguous rows will be selected (because all of the data cannot be sorted in a relevant order).
I have built a small script that essentially creates a string that will populate with whatever rows need to be copied over (see below). The problem is, when I try to pass that in the Range() function, the argument is too long for VBA (and thus it throws a 1094 error). Is there some easy way to linebreak the string so it is built in a way that the Range() function doesn't have an issue with? Like I said, this string variable is dynamic (the database is constantly changing and getting larger), so it will not be a fixed length every time.
<CODE>
' variable that details the rows that need to be copied over
temp = temp & i & ":" & i & ","
' selecting and copying the rows from above and pasting them onto sheet 1
ActiveSheet.Range(temp).Select
Selection.Copy
Sheets("Sheet1").Select
Sheets("Sheet1").Activate
Range("A1").Select
ActiveSheet.Paste
<CODE>
The error is thrown on the "ActiveSheet.Range(temp).Select" line, because the temp variable is too long.
I would greatly appreciate any help.
What I am trying to do is search a large database for certain data and paste that particular data to another sheet. So, a lot of non-contiguous rows will be selected (because all of the data cannot be sorted in a relevant order).
I have built a small script that essentially creates a string that will populate with whatever rows need to be copied over (see below). The problem is, when I try to pass that in the Range() function, the argument is too long for VBA (and thus it throws a 1094 error). Is there some easy way to linebreak the string so it is built in a way that the Range() function doesn't have an issue with? Like I said, this string variable is dynamic (the database is constantly changing and getting larger), so it will not be a fixed length every time.
<CODE>
' variable that details the rows that need to be copied over
temp = temp & i & ":" & i & ","
' selecting and copying the rows from above and pasting them onto sheet 1
ActiveSheet.Range(temp).Select
Selection.Copy
Sheets("Sheet1").Select
Sheets("Sheet1").Activate
Range("A1").Select
ActiveSheet.Paste
<CODE>
The error is thrown on the "ActiveSheet.Range(temp).Select" line, because the temp variable is too long.
I would greatly appreciate any help.