Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default find specific data in row and select and copy entirerow

Hi Sir,

I am trying to find a row that contains a specific part number in one
worksheet and copy that line into another worksheet. However, the vb debugger
also find error in the line activecellrow.select that disallow it from copy
the selected row and copy it into the destinated worksheet. What shall i do?
How do you write it properly in vba, coz i am using the record macro
available in the excel to create below lines.

Example of mine:


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

i = ActiveCell.Row


For i = 2 To 100

If Len(Worksheets("Sheet1").Cells(i, 2)) < 30 Then


Windows("VSJ Reschedule1.xls").Activate
Sheets("Sheet1").Select
Range("B2").Select
Selection.Copy

Sheets("vsj").Select
Columns("F:F").Select
Selection.Find(What:="A0699-5327", After:=ActiveCell,
LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate

ActiveCellRow.Select
Application.CutCopyMode = 1
Selection.Copy
Sheets("Sheet2").Select
ActiveSheet.Paste

Sheets("Sheet1").Select
Range("B6").Select
Application.CutCopyMode = False
Selection.Copy

End If

Next i

MsgBox ("Please run Macro2 after filling in all info")

End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default find specific data in row and select and copy entirerow

It should be ActiveCell.Row.Select
--
- K Dales


"Junior728" wrote:

Hi Sir,

I am trying to find a row that contains a specific part number in one
worksheet and copy that line into another worksheet. However, the vb debugger
also find error in the line activecellrow.select that disallow it from copy
the selected row and copy it into the destinated worksheet. What shall i do?
How do you write it properly in vba, coz i am using the record macro
available in the excel to create below lines.

Example of mine:


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

i = ActiveCell.Row


For i = 2 To 100

If Len(Worksheets("Sheet1").Cells(i, 2)) < 30 Then


Windows("VSJ Reschedule1.xls").Activate
Sheets("Sheet1").Select
Range("B2").Select
Selection.Copy

Sheets("vsj").Select
Columns("F:F").Select
Selection.Find(What:="A0699-5327", After:=ActiveCell,
LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate

ActiveCellRow.Select
Application.CutCopyMode = 1
Selection.Copy
Sheets("Sheet2").Select
ActiveSheet.Paste

Sheets("Sheet1").Select
Range("B6").Select
Application.CutCopyMode = False
Selection.Copy

End If

Next i

MsgBox ("Please run Macro2 after filling in all info")

End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default find specific data in row and select and copy entirerow

Probably:
activecell.entirerow.select

K Dales wrote:

It should be ActiveCell.Row.Select
--
- K Dales

"Junior728" wrote:

Hi Sir,

I am trying to find a row that contains a specific part number in one
worksheet and copy that line into another worksheet. However, the vb debugger
also find error in the line activecellrow.select that disallow it from copy
the selected row and copy it into the destinated worksheet. What shall i do?
How do you write it properly in vba, coz i am using the record macro
available in the excel to create below lines.

Example of mine:


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

i = ActiveCell.Row


For i = 2 To 100

If Len(Worksheets("Sheet1").Cells(i, 2)) < 30 Then


Windows("VSJ Reschedule1.xls").Activate
Sheets("Sheet1").Select
Range("B2").Select
Selection.Copy

Sheets("vsj").Select
Columns("F:F").Select
Selection.Find(What:="A0699-5327", After:=ActiveCell,
LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate

ActiveCellRow.Select
Application.CutCopyMode = 1
Selection.Copy
Sheets("Sheet2").Select
ActiveSheet.Paste

Sheets("Sheet1").Select
Range("B6").Select
Application.CutCopyMode = False
Selection.Copy

End If

Next i

MsgBox ("Please run Macro2 after filling in all info")

End Sub


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default find specific data in row and select and copy entirerow

Yes, my mistake!
--
- K Dales


"Dave Peterson" wrote:

Probably:
activecell.entirerow.select

K Dales wrote:

It should be ActiveCell.Row.Select
--
- K Dales

"Junior728" wrote:

Hi Sir,

I am trying to find a row that contains a specific part number in one
worksheet and copy that line into another worksheet. However, the vb debugger
also find error in the line activecellrow.select that disallow it from copy
the selected row and copy it into the destinated worksheet. What shall i do?
How do you write it properly in vba, coz i am using the record macro
available in the excel to create below lines.

Example of mine:


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

i = ActiveCell.Row


For i = 2 To 100

If Len(Worksheets("Sheet1").Cells(i, 2)) < 30 Then


Windows("VSJ Reschedule1.xls").Activate
Sheets("Sheet1").Select
Range("B2").Select
Selection.Copy

Sheets("vsj").Select
Columns("F:F").Select
Selection.Find(What:="A0699-5327", After:=ActiveCell,
LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate

ActiveCellRow.Select
Application.CutCopyMode = 1
Selection.Copy
Sheets("Sheet2").Select
ActiveSheet.Paste

Sheets("Sheet1").Select
Range("B6").Select
Application.CutCopyMode = False
Selection.Copy

End If

Next i

MsgBox ("Please run Macro2 after filling in all info")

End Sub


--

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
How do I find and copy rows based on specific criteria? Georgew New Users to Excel 3 May 29th 09 11:07 AM
Select, find in another book, copy, return and paste Watson[_2_] Excel Discussion (Misc queries) 0 August 15th 08 07:14 PM
Select specific Data from a cell [email protected] Excel Programming 11 March 30th 05 08:28 PM
Auto find a specific row and copy it to another worksheet hme Excel Programming 0 November 2nd 04 08:37 AM
Auto find a specific row and copy it to another worksheet hme Excel Programming 1 November 1st 04 02:29 PM


All times are GMT +1. The time now is 05:43 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"