Thread
:
Macro not working in personal.xls
View Single Post
#
4
Posted to microsoft.public.excel.programming
Dave Peterson
external usenet poster
Posts: 35,218
Macro not working in personal.xls
How about
:
Dim s1 As worksheet
'....
Set s1 = activesheet
I'm gonna guess that you want your code to run against the activesheet--no
matter what that sheet is (or where it is).
wrote:
Is there a special rule in using call procedure macros in a
personal.xls project vs. a VBAproject assigned to a specific
worksheet? The following macro allows me to search col 3 until the
data runs out & parse out certain characters into col 4. This works
when the macro is setup for a specific but fails to run or give an
error when it's in personal.xls module. I have tried this in both
2003 & 2007 versions of excel. I would appreciate any help. Thanks.
Sub AccountType()
Dim s1 As Sheet1
Dim row As Integer
Dim sTemp As String
Set s1 = Sheet1
row = 4
Do Until s1.Cells(row, 1) = ""
sTemp = s1.Cells(row, 3)
sTemp = Right(sTemp, Len(sTemp) - 4)
s1.Cells(row, 4).Value = sTemp
row = row + 1
Loop
End Sub
--
Dave Peterson
Reply With Quote
Dave Peterson
View Public Profile
Find all posts by Dave Peterson