View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bernie Deitrick Bernie Deitrick is offline
external usenet poster
 
Posts: 5,441
Default Sub that will not end

Rebekah,

I'm not sure why you would want to loop: this will work on the activecell's row.


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

Sub AutoFillIn()
Cells(ActiveCell.Row, 9).Value = UserNameWindows()
If InStr("username string from your example here", UserNameWindows()) 0 Then
Cells(ActiveCell.Row, 7).Value = "YES"
Else
Cells(ActiveCell.Row, 7).Value = "NO"
End If
End Sub


HTH,
Bernie
MS Excel MVP


"RebekahK20_pontiac via OfficeKB.com" <u36479@uwe wrote in message news:772dd83ad1b81@uwe...
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