Here's one for you...
This code runs, but produces incorrect results. As you can see, I SPECIFICALLY stated that If (Range("a" & irow)) = "Router", then perform commands. Why am I getting results in which other devices (Switches, Firewall, etc. ) are included in results??
Code:
For Each ws In Application.ActiveWorkbook.Worksheets 'This is the first FOR loop that loops through all the worksheets
If ws.Name <> mySheet And ws.Name <> mySheet2 Then 'This line of code skips analyzing the SUMMARY sheet (first sheet)
max = ActiveSheet.UsedRange.Rows.Count
For irow = 2 To max 'This is the SECOND FOR loop that loops vertically through the rows
If (Range("a" & irow)) = "Router" Then 'Why is this not working??***
orow = orow + 1
Range("'SUMMARY'!a" & orow) = ws.Range("a" & irow) 'This line of code pastes device type
Range("'SUMMARY'!b" & orow) = ws.Name 'This line of code pastes Worksheet name
Range("'SUMMARY'!c" & orow) = ws.Range("b" & irow) 'This line of code pastes Vendor
Range("'SUMMARY'!d" & orow) = ws.Range("c" & irow) 'This line of code pastes Hardware
Range("'SUMMARY'!e" & orow) = ws.Range("d" & irow) 'This line of code pastes Software
Range("'SUMMARY'!f" & orow) = ws.Range("e" & irow) 'This line of code pastes Sizing Mb
Range("'SUMMARY'!g" & orow) = ws.Range("f" & irow) 'This line of code pastes Notes
End If
Next irow
End If
Next ws
Results:
If someone could help me figure this out I can finally stop working today!!!

Aucun commentaire:
Enregistrer un commentaire