Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 131
Default Tap F9 until value is true..

Hi,

I have a formula in N1 that indicates if M:M don't have any duplicates. If
there are no duplicates it says 'True' else 'false'

Need to macro to run until value in N1 becomes true..

Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Tap F9 until value is true..

Maybe something like:

Option Explicit
Sub testme()
Dim myCell As Range
Dim MaxCount As Long
Dim iCtr As Long
Dim FoundIt As Boolean
Dim wks As Worksheet

Set wks = ActiveSheet

Set myCell = wks.Range("N1")

MaxCount = 1000 'no more than 1000 for my testing

FoundIt = False
If myCell.Value = True Then
'do nothing
FoundIt = True
Else
iCtr = 0
Application.ScreenUpdating = False
Do
iCtr = iCtr + 1
Application.Calculate
If myCell.Value = True Then
FoundIt = True
Exit Do
Else
If iCtr MaxCount Then
Exit Do
End If
End If
Loop
Application.ScreenUpdating = True
End If

If FoundIt = False Then
MsgBox "No solution found after: " & MaxCount & " tries."
Else
MsgBox "ok--found on iteration: " & iCtr
End If

End Sub


Kashyap wrote:

Hi,

I have a formula in N1 that indicates if M:M don't have any duplicates. If
there are no duplicates it says 'True' else 'false'

Need to macro to run until value in N1 becomes true..

Thanks.


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Tap F9 until value is true..

I really wanted the "ictr = 0" higher up in the code (I changed something else
and didn't fix that line):

Option Explicit
Sub testme()

Dim myCell As Range
Dim MaxCount As Long
Dim iCtr As Long
Dim FoundIt As Boolean
Dim wks As Worksheet

Set wks = ActiveSheet

Set myCell = wks.Range("N1")

MaxCount = 1000 'no more than 1000 for my testing

iCtr = 0
FoundIt = False
If myCell.Value = True Then
'do nothing
FoundIt = True
Else
Application.ScreenUpdating = False
Do
iCtr = iCtr + 1
Application.Calculate
If myCell.Value = True Then
FoundIt = True
Exit Do
Else
If iCtr MaxCount Then
Exit Do
End If
End If
Loop
Application.ScreenUpdating = True
End If

If FoundIt = False Then
MsgBox "No solution found after: " & MaxCount & " tries."
Else
MsgBox "ok--found on iteration: " & iCtr
End If

End Sub

Dave Peterson wrote:

Maybe something like:

Option Explicit
Sub testme()
Dim myCell As Range
Dim MaxCount As Long
Dim iCtr As Long
Dim FoundIt As Boolean
Dim wks As Worksheet

Set wks = ActiveSheet

Set myCell = wks.Range("N1")

MaxCount = 1000 'no more than 1000 for my testing

FoundIt = False
If myCell.Value = True Then
'do nothing
FoundIt = True
Else
iCtr = 0
Application.ScreenUpdating = False
Do
iCtr = iCtr + 1
Application.Calculate
If myCell.Value = True Then
FoundIt = True
Exit Do
Else
If iCtr MaxCount Then
Exit Do
End If
End If
Loop
Application.ScreenUpdating = True
End If

If FoundIt = False Then
MsgBox "No solution found after: " & MaxCount & " tries."
Else
MsgBox "ok--found on iteration: " & iCtr
End If

End Sub

Kashyap wrote:

Hi,

I have a formula in N1 that indicates if M:M don't have any duplicates. If
there are no duplicates it says 'True' else 'false'

Need to macro to run until value in N1 becomes true..

Thanks.


--

Dave Peterson


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 131
Default Tap F9 until value is true..

Thnaks Dave

"Dave Peterson" wrote:

I really wanted the "ictr = 0" higher up in the code (I changed something else
and didn't fix that line):

Option Explicit
Sub testme()

Dim myCell As Range
Dim MaxCount As Long
Dim iCtr As Long
Dim FoundIt As Boolean
Dim wks As Worksheet

Set wks = ActiveSheet

Set myCell = wks.Range("N1")

MaxCount = 1000 'no more than 1000 for my testing

iCtr = 0
FoundIt = False
If myCell.Value = True Then
'do nothing
FoundIt = True
Else
Application.ScreenUpdating = False
Do
iCtr = iCtr + 1
Application.Calculate
If myCell.Value = True Then
FoundIt = True
Exit Do
Else
If iCtr MaxCount Then
Exit Do
End If
End If
Loop
Application.ScreenUpdating = True
End If

If FoundIt = False Then
MsgBox "No solution found after: " & MaxCount & " tries."
Else
MsgBox "ok--found on iteration: " & iCtr
End If

End Sub

Dave Peterson wrote:

Maybe something like:

Option Explicit
Sub testme()
Dim myCell As Range
Dim MaxCount As Long
Dim iCtr As Long
Dim FoundIt As Boolean
Dim wks As Worksheet

Set wks = ActiveSheet

Set myCell = wks.Range("N1")

MaxCount = 1000 'no more than 1000 for my testing

FoundIt = False
If myCell.Value = True Then
'do nothing
FoundIt = True
Else
iCtr = 0
Application.ScreenUpdating = False
Do
iCtr = iCtr + 1
Application.Calculate
If myCell.Value = True Then
FoundIt = True
Exit Do
Else
If iCtr MaxCount Then
Exit Do
End If
End If
Loop
Application.ScreenUpdating = True
End If

If FoundIt = False Then
MsgBox "No solution found after: " & MaxCount & " tries."
Else
MsgBox "ok--found on iteration: " & iCtr
End If

End Sub

Kashyap wrote:

Hi,

I have a formula in N1 that indicates if M:M don't have any duplicates. If
there are no duplicates it says 'True' else 'false'

Need to macro to run until value in N1 becomes true..

Thanks.


--

Dave Peterson


--

Dave Peterson

Reply
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
if any of 3 conditions is true, then answer is true inthestands Excel Worksheet Functions 5 November 16th 06 12:02 AM
Search for 2 true arguments and return true or false David Excel Discussion (Misc queries) 3 July 15th 06 10:18 AM
Function to return True/False if all are validated as True by ISNU Tetsuya Oguma Excel Worksheet Functions 2 March 15th 06 10:28 AM
How do I stop Excel from changing the word true to TRUE? Schmyerlou Excel Discussion (Misc queries) 1 November 23rd 05 08:54 PM
Reverse false and combine with true true value Emmie99 Excel Worksheet Functions 5 August 17th 05 04:38 PM


All times are GMT +1. The time now is 03:15 PM.

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

About Us

"It's about Microsoft Excel"