View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Vergel Adriano Vergel Adriano is offline
external usenet poster
 
Posts: 857
Default Macro not working in personal.xls

It should be

Dim s1 As WorkSheet


--
Hope that helps.

Vergel Adriano


" wrote:

On Apr 19, 10:56 am, Vergel Adriano
wrote:
Hi,

Try it this way:

Sub AccountType()
Dim s1 As Sheet
Dim row As Integer
Dim sTemp As String

Set s1 = ActiveWorkbook.Sheets("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

--
Hope that helps.

Vergel Adriano



" 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- Hide quoted text -


- Show quoted text -


Thx. Tried this & I get Compile error: User-defined type not defined
for: s1 As Sheet