Macro problems

Z

zaki

Having problems with another macro, i dont understand how they randomly just
trip up. The below code is working absolutely fine and changes the desired
text to how i want it to, but for "Applabs" it changes everything in the
corresponding cell to Sub contractor (as it should) BUTbut misses the last
cell out! The last one stays the same. why?

Please help. Appreciate all your help.

Sub subcon()
Dim r As Range
Dim srng As Range
Set srng = Range("e1", Range("e" & Rows.Count). _
End(xlUp)).SpecialCells(xlCellTypeConstants, xlTextValues)
For Each r In srng
Select Case r.Value
Case "AMS Subcon", "Apollo", "Applabs", "Capula", "Temporary Staff"
r.Offset(0, 1).Value = "Sub - Contractor"
End Select
Next r
End Sub
 
D

Dave Peterson

Check your earlier post.
Having problems with another macro, i dont understand how they randomly just
trip up. The below code is working absolutely fine and changes the desired
text to how i want it to, but for "Applabs" it changes everything in the
corresponding cell to Sub contractor (as it should) BUTbut misses the last
cell out! The last one stays the same. why?

Please help. Appreciate all your help.

Sub subcon()
Dim r As Range
Dim srng As Range
Set srng = Range("e1", Range("e" & Rows.Count). _
End(xlUp)).SpecialCells(xlCellTypeConstants, xlTextValues)
For Each r In srng
Select Case r.Value
Case "AMS Subcon", "Apollo", "Applabs", "Capula", "Temporary Staff"
r.Offset(0, 1).Value = "Sub - Contractor"
End Select
Next r
End Sub
 
B

Bob Phillips

Maybe you have blanks

Sub subcon()
Dim r As Range
Dim ar As Range
Dim srng As Range
Set srng = Range("e1", Range("e" & Rows.Count). _
End(xlUp)).SpecialCells(xlCellTypeConstants, xlTextValues)
For Each ar In srng.Areas
For Each r In ar
Select Case r.Value
Case "AMS Subcon", "Apollo", "Applabs", "Capula", "Temporary
Staff"
r.Offset(0, 1).Value = "Sub - Contractor"
End Select
Next r
Next ar
End Sub


--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top