Before I lose any more hair: Run-time error '9'
Thanks for the tip about copy. I'll change it. It's not really the problem
here, because it works in another workbook. Turns out it was City names
without equivalent worksheets.
"steve" wrote in message
...
Rick,
I am a little confused about how your code is supposed to work, but
reconsider using the term copy. This is a reserved word in Excel and
'instructs' Excel to do a copy like in:
Activecell.Copy
Selection.copy
I have learned to double check all terms in code with the F1 key. If I
get
a 'Key word not found' than it is OK to use. Otherwise you are prone to
crashes and other not-wanted events...
And just what is 'Selection.copy' copying?
Except for 'C3' you don't seem to be selecting anything...
AND - in most code you can eliminate the 'select' pieces...
You can get the same result with:
Cell.Copy
hth
--
sb
"Rick Campbell" wrote in message
nk.net...
I've been using the following code in a workbook successfully:
Public Sub SMCMonthlyUpdateSFR()
Sheets("work").Select
Range("C3").Select
Dim Cell As Range
For Each Cell In Range("B3:B27")
City = Cell.Value
Call copy
Next
End Sub
Public Sub copy()
Selection.copy
Sheets(City).Select
I copied the code to another workbook with the same format, different
data,
and now the City value is not being posted to Sheets(City).Select.
Can anyone tell me what the problem is?
TIA
Rick
|