LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default another loop question

"Patti" ha scritto nel messaggio
...

Try this.

---------------------------
Option Explicit
Private Sub testloop()

Dim lstrow As Long
Dim i As Long
Dim j As Long
Dim agtname As String, papi As String

lstrow = Range("a" & Rows.Count).End(xlUp).Row
papi = Range("A2").Text
For i = 2 To lstrow
agtname = Range("a" & i).Text
If agtname = papi Then
If Cells(i, 2).Value < "" Then
Select Case Cells(i, 2)
Case "This"
MsgBox "Current Type for " & agtname & " is blah blah blah"
& i
Case "That"
MsgBox "Current Type for " & agtname & " is yada yada
yada" & i
Case Else
MsgBox "Current Type for " & agtname & " is " & Cells(i, 2)
& " " & i
End Select
End If
Else
papi = agtname
MsgBox "moved on!"
i = i - 1
End If
Next i
End Sub
------------------


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Loop question aelewis Excel Discussion (Misc queries) 2 October 24th 07 08:12 PM
Loop question N.F[_2_] Excel Discussion (Misc queries) 0 July 12th 07 08:02 PM
Password Loop question. Andy Tallent Excel Discussion (Misc queries) 1 April 8th 05 01:16 PM
For loop question luvgreen[_3_] Excel Programming 1 February 20th 04 03:30 PM
For Loop and If Statement question jacqui[_2_] Excel Programming 4 February 13th 04 09:24 PM


All times are GMT +1. The time now is 07:23 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"