Multiple conditions multiple worksheets VBA
Closed
Np72
Posts
1
Registration date
Thursday December 15, 2011
Status
Member
Last seen
December 15, 2011
-
Dec 15, 2011 at 10:17 AM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Dec 20, 2011 at 10:04 AM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Dec 20, 2011 at 10:04 AM
Related:
- Multiple conditions multiple worksheets VBA
- Allow multiple downloads chrome - Guide
- How to delete multiple files on mac - Guide
- Photoshop multiple selections - Guide
- Mpc-hc multiple instances - Guide
- Vba case like - Guide
1 response
TrowaD
Posts
2921
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
December 27, 2022
555
Dec 20, 2011 at 10:04 AM
Dec 20, 2011 at 10:04 AM
Hi Np72,
Based on the line:
"I would like the macro to copy from sheet 1 anything that has the country code 'ITA' and is greater than 0.185 Place into a sheet called Italy"
I have written the following code:
Then you say:
"then repeat the above and place the results in 'Italy' under the previously captured results"
This is done by running the code again.
But it's not clear to me what you want to do with sheet2. Ignore it?, search it as well?
Best regards,
Trowa
Based on the line:
"I would like the macro to copy from sheet 1 anything that has the country code 'ITA' and is greater than 0.185 Place into a sheet called Italy"
I have written the following code:
Sub test() Dim lRow, lRow2 As Integer Dim cell As Range lRow = Sheets("Sheet1").Range("G" & Rows.Count).End(xlUp).Row For Each cell In Range("G2:G" & lRow) If cell.Value = "ITA" And cell.Offset(0, -4).Value > 0.185 Then lRow2 = Sheets("Italy").Range("G" & Rows.Count).End(xlUp).Row cell.EntireRow.Copy Destination:=Sheets("Italy").Range("A" & lRow2 + 1) End If Next cell End Sub
Then you say:
"then repeat the above and place the results in 'Italy' under the previously captured results"
This is done by running the code again.
But it's not clear to me what you want to do with sheet2. Ignore it?, search it as well?
Best regards,
Trowa