While this code runs, it seems to be skipping the 45th row any idea why this is occurring its copying values from excel to notepad...
Option Explicit
Public waitTill As Date
#If VBA7 And Win64 Then
' 64 bit Excel
'The following line is supposed to be RED in 32 bit Excel
Public Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
#Else
' 32 bit Excel
Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
#End If
Sub Lookup()
Dim iColumn As Long
Dim iLastColumn As Long
Dim iRow As Long
Dim bNeedMore As Boolean
Dim Sel As String
Dim MoveDown As String
Dim pH As Single
Dim Program As String
Dim sValue As String
iLastColumn = Cells.Find(What:="*", SearchOrder:=xlByColumns, SearchDirection:=xlPrevious).Column
For iColumn = 1 To iLastColumn
'Reset the Row to the row before the first row
iRow = 0
Debug.Print "''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''"
'Loop Until there is a blank value in a cell
bNeedMore = True
While bNeedMore = True
'Increment the Row Number
'Get the next value as text without leading and trailing spaces
iRow = iRow + 1
sValue = Left(Cells(iRow, iColumn), 200)
Debug.Print iRow, iColumn, sValue 'Output to Immediate Window (CTRL G) in debugger
Sleep 100
If IsNumeric(sValue) Then
'Process as required
If sValue >= 1 Then
Program = sValue 'PROGRAM (converted to an integer string) IS NOW THE OUTPUT TO A SECOND APP
ElseIf sValue < 1 Then
Program = ""
End If
Sleep 100
Else
'Cell value is NOT a number - done processing this column
bNeedMore = False
Program = ""
Debug.Print "''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''"
End If
Sleep 100 'ADD THIS LINE
Application.SendKeys "%{ESC}", True
Sleep 100
Application.SendKeys sValue, True 'THIS IS WHERE THE OUTPUT OCCURS
Sleep 100
Application.SendKeys "{UP}", True 'THIS IS WHERE THE OUTPUT OCCURS
Sleep 100
AppActivate ("Microsoft Excel"), True
Sleep 500 'ADD THIS LINE
Wend
Next iColumn
End Sub
Bookmarks