View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
RebekahK20_pontiac via OfficeKB.com RebekahK20_pontiac via OfficeKB.com is offline
external usenet poster
 
Posts: 13
Default Sub that will not end

OK Dave,
This was working but since I added it to the end of the ctrl g sub, it now
returns a #Name? in the cell....
I need it to return the username no matter what...
TIA... Maybe it's just friday so I'm not sure what I did...

Dave Peterson wrote:
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?

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

[quoted text clipped - 32 lines]
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200708/1



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