View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Sub that will not end

I'd try:
Option Explicit
Function UserNameWindows() As String
UserNameWindows = Environ("USERNAME")
End Function
Sub AutoFillIn()
Dim myNames As Variant
Dim c As Range
Dim res As Variant

myNames = Array("dadunlap", "slhull", "mdringler", _
"sljackson", "ccparker", "thenry", _
"rdowling", "jslong", "mhjames", _
"lndavis", "jdscott", "jfullem", _
"alwrinch")

For Each c In Range("A8:A1000")
If c.Value = "" Then
Exit For
End If
c.Offset(0, 8).Formula = "=UserNameWindows()"
res = Application.Match(UserNameWindows, myNames, 0)
If IsNumeric(res) Then
'found it
c.Offset(0, 6).Value = "YES"
Else
c.Offset(0, 6).Value = "NO"
End If
Next c
End Sub

====
But isn't this putting the same value in those offset cells for each row?

"RebekahK20_pontiac via OfficeKB.com" wrote:

I have a Sub that will not end? Any ideas...

Function UserNameWindows() As String
UserNameWindows = Environ("USERNAME")
End Function


Sub AutoFillIn()
Dim c As Range
Do Until ActiveCell = ""


For Each c In Range("A8", "A1000")

ActiveCell.Offset(0, 8) = "=UserNameWindows()"

If "USERNAME" = "dadunlap,slhull,mdringler,sljackson,ccparker,
thenry,rdowling,jslong,mhjames,lndavis,jdscott,jfu llem,alwrinch" Then
ActiveCell.Offset(0, 6) = "YES"
Else: ActiveCell.Offset(0, 6) = "NO"
End If

ActiveCell.Offset(1, 0).Select

Next c
Loop
End Sub

Also how can I get this to start at the end of another comand that is started
with ctrl + g. ?

TIA

Rebekah

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200708/1


--

Dave Peterson