G
Guest
Hi Sir,
i am trying to find active cell value(Testing) from a column set of data but
when it comes to line:
Testing = Cells(i, 2).Value
Selection.Find(What:=Testing, After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
it cannot continue to run the rest of the macro? why? Other than selection
find function, is there any other alternate function to obtain the same
results? Thanks.
Example:
Sub Reschedule()
Range("A1").Select
With Application
.Calculation = xlAutomatic
End With
With Application
.ReferenceStyle = xlA1
End With
Range("A1").Select
NumOfRows = Cells(Rows.Count, 1).End(xlUp).Row
Workbooks.Open Filename:="G:\Asia\Product\Operations\Part
Adjustments\VSJ Reschedule\vsj.xls"
Windows("vsj.xls").Activate
Windows("VSJ Reschedule1.xls").Activate
Sheets.Add
Windows("vsj.xls").Activate
Sheets("vsj").Select
Application.CutCopyMode = False
Sheets("vsj").Copy After:=Workbooks("VSJ Reschedule1.xls").Sheets(2)
ActiveWindow.SmallScroll Down:=-15
Windows("VSJ Reschedule1.xls").Activate
Sheets("Sheet1").Select
i = ActiveCell.Row
Testing = Cells(i, 2).Value
Range("B2").Select
For i = 2 To NumOfRows
If Not IsError(Testing) Then
ActiveCell.Select
Selection.Copy
Sheets("vsj").Select
Columns("F:F").Select
Selection.Find(What:=Testing, After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
ActiveCell.EntireRow.Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet2").Select
ActiveSheet.Paste
End If
Next i
MsgBox ("Please run Macro2 after filling in all info")
End Sub
i am trying to find active cell value(Testing) from a column set of data but
when it comes to line:
Testing = Cells(i, 2).Value
Selection.Find(What:=Testing, After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
it cannot continue to run the rest of the macro? why? Other than selection
find function, is there any other alternate function to obtain the same
results? Thanks.
Example:
Sub Reschedule()
Range("A1").Select
With Application
.Calculation = xlAutomatic
End With
With Application
.ReferenceStyle = xlA1
End With
Range("A1").Select
NumOfRows = Cells(Rows.Count, 1).End(xlUp).Row
Workbooks.Open Filename:="G:\Asia\Product\Operations\Part
Adjustments\VSJ Reschedule\vsj.xls"
Windows("vsj.xls").Activate
Windows("VSJ Reschedule1.xls").Activate
Sheets.Add
Windows("vsj.xls").Activate
Sheets("vsj").Select
Application.CutCopyMode = False
Sheets("vsj").Copy After:=Workbooks("VSJ Reschedule1.xls").Sheets(2)
ActiveWindow.SmallScroll Down:=-15
Windows("VSJ Reschedule1.xls").Activate
Sheets("Sheet1").Select
i = ActiveCell.Row
Testing = Cells(i, 2).Value
Range("B2").Select
For i = 2 To NumOfRows
If Not IsError(Testing) Then
ActiveCell.Select
Selection.Copy
Sheets("vsj").Select
Columns("F:F").Select
Selection.Find(What:=Testing, After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
ActiveCell.EntireRow.Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet2").Select
ActiveSheet.Paste
End If
Next i
MsgBox ("Please run Macro2 after filling in all info")
End Sub