Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Find then paste

Sub FindPaste()

Application.ScreenUpdating = False
With Sheets("Statement")
With .Range("B3", .Range("B" & .Rows.Count).End(xlUp))
.Offset(-1).Resize(.Rows.Count + 1).AutoFilter _
Field:=1, Criteria1:="Agent"
On Error Resume Next
Sheets("Examine").Range("O1:AG1").Copy _
Destination:=.Offset(, 13).SpecialCells(xlCellTypeVisible)
On Error GoTo 0
End With
.AutoFilterMode = False
End With
Application.ScreenUpdating = True

End Sub


My goal is to create a macro that will look in Column B of worksheet
€śStatement€ť ,starting in row 3, for the text €śAgent€ť. When that text is
found I would like to copy that row Columns O:AG and then paste it into the
range O1:G1 of worksheet €śExamine.€ť

The macro above will find the text €śAgent€ť in Column B and then paste the
range from worksheet €śExamine€ť into it, but I am trying to do the opposite.
I want to copy from random range based on text in worksheet €śStatement€ť
Column O:AG and paste the data into specific range in worksheet €śExamine€ť
O1:AG1. I gladly welcome any help. Thank you.



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default Find then paste

Hi

In the 'Copy' statement you have to switch CopyRng and Destination range.
The macro is changed as I would write it, but not tested:

Sub FindPaste()
Dim FilterRng As Range
Dim CopyRng As Range
Application.ScreenUpdating = False

With Sheets("Statement")
Set FilterRng = .Range("B2", .Range("B" & Rows.Count).End(xlUp))
Set CopyRng = .Range("B3", .Range("B" & Rows.Count).End(xlUp))
End With

FilterRng.AutoFilter Field:=1, Criteria1:="Agent"
If CopyRng.SpecialCells(xlCellTypeVisible).Rows.Count 0 Then
CopyRng.SpecialCells(xlCellTypeVisible).Offset(0, 13).Resize _
(CopyRng.SpecialCells(xlCellTypeVisible).Rows.Coun t, 19).Copy _
Destination:=Sheets("Examine").Range("O1")
End If

Sheets("Statement").AutoFilterMode = False
Application.ScreenUpdating = True
End Sub

Regards,
Per

"Teddy" skrev i meddelelsen
...
Sub FindPaste()

Application.ScreenUpdating = False
With Sheets("Statement")
With .Range("B3", .Range("B" & .Rows.Count).End(xlUp))
.Offset(-1).Resize(.Rows.Count + 1).AutoFilter _
Field:=1, Criteria1:="Agent"
On Error Resume Next
Sheets("Examine").Range("O1:AG1").Copy _
Destination:=.Offset(, 13).SpecialCells(xlCellTypeVisible)
On Error GoTo 0
End With
.AutoFilterMode = False
End With
Application.ScreenUpdating = True

End Sub


My goal is to create a macro that will look in Column B of worksheet
€śStatement€ť ,starting in row 3, for the text €śAgent€ť. When that text is
found I would like to copy that row Columns O:AG and then paste it into
the
range O1:G1 of worksheet €śExamine.€ť

The macro above will find the text €śAgent€ť in Column B and then paste the
range from worksheet €śExamine€ť into it, but I am trying to do the
opposite.
I want to copy from random range based on text in worksheet €śStatement€ť
Column O:AG and paste the data into specific range in worksheet €śExamine€ť
O1:AG1. I gladly welcome any help. Thank you.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Find then paste

Sweet. Thank you. Very very close. Y:AG from "Statement" is getting pasted
into O1:Y1 of "Examine".

I am aiming for O:AG of "Statement" to get into O:AG of "Examine". Any
input is appreciated.

"Per Jessen" wrote:

Hi

In the 'Copy' statement you have to switch CopyRng and Destination range.
The macro is changed as I would write it, but not tested:

Sub FindPaste()
Dim FilterRng As Range
Dim CopyRng As Range
Application.ScreenUpdating = False

With Sheets("Statement")
Set FilterRng = .Range("B2", .Range("B" & Rows.Count).End(xlUp))
Set CopyRng = .Range("B3", .Range("B" & Rows.Count).End(xlUp))
End With

FilterRng.AutoFilter Field:=1, Criteria1:="Agent"
If CopyRng.SpecialCells(xlCellTypeVisible).Rows.Count 0 Then
CopyRng.SpecialCells(xlCellTypeVisible).Offset(0, 13).Resize _
(CopyRng.SpecialCells(xlCellTypeVisible).Rows.Coun t, 19).Copy _
Destination:=Sheets("Examine").Range("O1")
End If

Sheets("Statement").AutoFilterMode = False
Application.ScreenUpdating = True
End Sub

Regards,
Per

"Teddy" skrev i meddelelsen
...
Sub FindPaste()

Application.ScreenUpdating = False
With Sheets("Statement")
With .Range("B3", .Range("B" & .Rows.Count).End(xlUp))
.Offset(-1).Resize(.Rows.Count + 1).AutoFilter _
Field:=1, Criteria1:="Agent"
On Error Resume Next
Sheets("Examine").Range("O1:AG1").Copy _
Destination:=.Offset(, 13).SpecialCells(xlCellTypeVisible)
On Error GoTo 0
End With
.AutoFilterMode = False
End With
Application.ScreenUpdating = True

End Sub


My goal is to create a macro that will look in Column B of worksheet
€śStatement€ť ,starting in row 3, for the text €śAgent€ť. When that text is
found I would like to copy that row Columns O:AG and then paste it into
the
range O1:G1 of worksheet €śExamine.€ť

The macro above will find the text €śAgent€ť in Column B and then paste the
range from worksheet €śExamine€ť into it, but I am trying to do the
opposite.
I want to copy from random range based on text in worksheet €śStatement€ť
Column O:AG and paste the data into specific range in worksheet €śExamine€ť
O1:AG1. I gladly welcome any help. Thank you.



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default Find then paste

It is working on my test data, do you by chance have any hidden columns,
when you run the macro?

---
Per

"Teddy" skrev i meddelelsen
...
Sweet. Thank you. Very very close. Y:AG from "Statement" is getting
pasted
into O1:Y1 of "Examine".

I am aiming for O:AG of "Statement" to get into O:AG of "Examine". Any
input is appreciated.

"Per Jessen" wrote:

Hi

In the 'Copy' statement you have to switch CopyRng and Destination range.
The macro is changed as I would write it, but not tested:

Sub FindPaste()
Dim FilterRng As Range
Dim CopyRng As Range
Application.ScreenUpdating = False

With Sheets("Statement")
Set FilterRng = .Range("B2", .Range("B" & Rows.Count).End(xlUp))
Set CopyRng = .Range("B3", .Range("B" & Rows.Count).End(xlUp))
End With

FilterRng.AutoFilter Field:=1, Criteria1:="Agent"
If CopyRng.SpecialCells(xlCellTypeVisible).Rows.Count 0 Then
CopyRng.SpecialCells(xlCellTypeVisible).Offset(0, 13).Resize _
(CopyRng.SpecialCells(xlCellTypeVisible).Rows.Coun t, 19).Copy _
Destination:=Sheets("Examine").Range("O1")
End If

Sheets("Statement").AutoFilterMode = False
Application.ScreenUpdating = True
End Sub

Regards,
Per

"Teddy" skrev i meddelelsen
...
Sub FindPaste()

Application.ScreenUpdating = False
With Sheets("Statement")
With .Range("B3", .Range("B" & .Rows.Count).End(xlUp))
.Offset(-1).Resize(.Rows.Count + 1).AutoFilter _
Field:=1, Criteria1:="Agent"
On Error Resume Next
Sheets("Examine").Range("O1:AG1").Copy _
Destination:=.Offset(,
13).SpecialCells(xlCellTypeVisible)
On Error GoTo 0
End With
.AutoFilterMode = False
End With
Application.ScreenUpdating = True

End Sub


My goal is to create a macro that will look in Column B of worksheet
€śStatement€ť ,starting in row 3, for the text €śAgent€ť. When that text
is
found I would like to copy that row Columns O:AG and then paste it into
the
range O1:G1 of worksheet €śExamine.€ť

The macro above will find the text €śAgent€ť in Column B and then paste
the
range from worksheet €śExamine€ť into it, but I am trying to do the
opposite.
I want to copy from random range based on text in worksheet €śStatement€ť
Column O:AG and paste the data into specific range in worksheet
€śExamine€ť
O1:AG1. I gladly welcome any help. Thank you.



.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Find then paste

Awesome.

I changed

CopyRng.SpecialCells(xlCellTypeVisible).Offset(0, 13).Resize _
(CopyRng.SpecialCells(xlCellTypeVisible).Rows.Coun t, 19).Copy _

to

CopyRng.SpecialCells(xlCellTypeVisible).Offset(0, 3).Resize _
(CopyRng.SpecialCells(xlCellTypeVisible).Rows.Coun t, 31).Copy _

and got the result I was after. Thanks again for the help, I needed it very
much.

"Per Jessen" wrote:

It is working on my test data, do you by chance have any hidden columns,
when you run the macro?

---
Per

"Teddy" skrev i meddelelsen
...
Sweet. Thank you. Very very close. Y:AG from "Statement" is getting
pasted
into O1:Y1 of "Examine".

I am aiming for O:AG of "Statement" to get into O:AG of "Examine". Any
input is appreciated.

"Per Jessen" wrote:

Hi

In the 'Copy' statement you have to switch CopyRng and Destination range.
The macro is changed as I would write it, but not tested:

Sub FindPaste()
Dim FilterRng As Range
Dim CopyRng As Range
Application.ScreenUpdating = False

With Sheets("Statement")
Set FilterRng = .Range("B2", .Range("B" & Rows.Count).End(xlUp))
Set CopyRng = .Range("B3", .Range("B" & Rows.Count).End(xlUp))
End With

FilterRng.AutoFilter Field:=1, Criteria1:="Agent"
If CopyRng.SpecialCells(xlCellTypeVisible).Rows.Count 0 Then
CopyRng.SpecialCells(xlCellTypeVisible).Offset(0, 13).Resize _
(CopyRng.SpecialCells(xlCellTypeVisible).Rows.Coun t, 19).Copy _
Destination:=Sheets("Examine").Range("O1")
End If

Sheets("Statement").AutoFilterMode = False
Application.ScreenUpdating = True
End Sub

Regards,
Per

"Teddy" skrev i meddelelsen
...
Sub FindPaste()

Application.ScreenUpdating = False
With Sheets("Statement")
With .Range("B3", .Range("B" & .Rows.Count).End(xlUp))
.Offset(-1).Resize(.Rows.Count + 1).AutoFilter _
Field:=1, Criteria1:="Agent"
On Error Resume Next
Sheets("Examine").Range("O1:AG1").Copy _
Destination:=.Offset(,
13).SpecialCells(xlCellTypeVisible)
On Error GoTo 0
End With
.AutoFilterMode = False
End With
Application.ScreenUpdating = True

End Sub


My goal is to create a macro that will look in Column B of worksheet
€śStatement€ť ,starting in row 3, for the text €śAgent€ť. When that text
is
found I would like to copy that row Columns O:AG and then paste it into
the
range O1:G1 of worksheet €śExamine.€ť

The macro above will find the text €śAgent€ť in Column B and then paste
the
range from worksheet €śExamine€ť into it, but I am trying to do the
opposite.
I want to copy from random range based on text in worksheet €śStatement€ť
Column O:AG and paste the data into specific range in worksheet
€śExamine€ť
O1:AG1. I gladly welcome any help. Thank you.



.

.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default Find then paste

Thanks for your reply. I am glad you solved it and got it working.

--
Per

"Teddy" skrev i meddelelsen
...
Awesome.

I changed

CopyRng.SpecialCells(xlCellTypeVisible).Offset(0, 13).Resize _
(CopyRng.SpecialCells(xlCellTypeVisible).Rows.Coun t, 19).Copy _

to

CopyRng.SpecialCells(xlCellTypeVisible).Offset(0, 3).Resize _
(CopyRng.SpecialCells(xlCellTypeVisible).Rows.Coun t, 31).Copy _

and got the result I was after. Thanks again for the help, I needed it
very
much.

"Per Jessen" wrote:

It is working on my test data, do you by chance have any hidden columns,
when you run the macro?

---
Per

"Teddy" skrev i meddelelsen
...
Sweet. Thank you. Very very close. Y:AG from "Statement" is getting
pasted
into O1:Y1 of "Examine".

I am aiming for O:AG of "Statement" to get into O:AG of "Examine". Any
input is appreciated.

"Per Jessen" wrote:

Hi

In the 'Copy' statement you have to switch CopyRng and Destination
range.
The macro is changed as I would write it, but not tested:

Sub FindPaste()
Dim FilterRng As Range
Dim CopyRng As Range
Application.ScreenUpdating = False

With Sheets("Statement")
Set FilterRng = .Range("B2", .Range("B" & Rows.Count).End(xlUp))
Set CopyRng = .Range("B3", .Range("B" & Rows.Count).End(xlUp))
End With

FilterRng.AutoFilter Field:=1, Criteria1:="Agent"
If CopyRng.SpecialCells(xlCellTypeVisible).Rows.Count 0 Then
CopyRng.SpecialCells(xlCellTypeVisible).Offset(0, 13).Resize _
(CopyRng.SpecialCells(xlCellTypeVisible).Rows.Coun t, 19).Copy
_
Destination:=Sheets("Examine").Range("O1")
End If

Sheets("Statement").AutoFilterMode = False
Application.ScreenUpdating = True
End Sub

Regards,
Per

"Teddy" skrev i meddelelsen
...
Sub FindPaste()

Application.ScreenUpdating = False
With Sheets("Statement")
With .Range("B3", .Range("B" & .Rows.Count).End(xlUp))
.Offset(-1).Resize(.Rows.Count + 1).AutoFilter _
Field:=1, Criteria1:="Agent"
On Error Resume Next
Sheets("Examine").Range("O1:AG1").Copy _
Destination:=.Offset(,
13).SpecialCells(xlCellTypeVisible)
On Error GoTo 0
End With
.AutoFilterMode = False
End With
Application.ScreenUpdating = True

End Sub


My goal is to create a macro that will look in Column B of worksheet
€śStatement€ť ,starting in row 3, for the text €śAgent€ť. When that
text
is
found I would like to copy that row Columns O:AG and then paste it
into
the
range O1:G1 of worksheet €śExamine.€ť

The macro above will find the text €śAgent€ť in Column B and then
paste
the
range from worksheet €śExamine€ť into it, but I am trying to do the
opposite.
I want to copy from random range based on text in worksheet
€śStatement€ť
Column O:AG and paste the data into specific range in worksheet
€śExamine€ť
O1:AG1. I gladly welcome any help. Thank you.



.

.

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
Find/Copy/paste.. then Find/Paste - not working ... at all.... [email protected] Excel Programming 9 November 30th 06 08:49 PM
find and paste enyaw Excel Programming 1 May 12th 06 02:41 PM
Find and Paste Ronbo Excel Programming 5 April 1st 06 03:20 AM
find and paste ceemo[_2_] Excel Programming 5 July 25th 05 06:10 PM
I need to find a macro to find data cut and paste to another colu. Rex Excel Programming 6 December 7th 04 09:22 AM


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