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

Hi..

I have a block of data A9:10000 - X9:10000. Is there any code that would
allow me to select any combination of rows in which the word 'aged' is found
and then to compact them into a new sheet? For example, if the word 'aged' is
only found on 130 random rows then those 130 are pasted into a new sheet as
one block of text.

Any help would be appreciated...

Thanks G
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 73
Default Selective paste

I'm using Excel 2007 and the following works for me (manually and/or via VBA
coding).

Use a filter to limit your data, copy the filtered data and paste it into
your new worksheet.

Good Luck.

"Gordon" wrote:

Hi..

I have a block of data A9:10000 - X9:10000. Is there any code that would
allow me to select any combination of rows in which the word 'aged' is found
and then to compact them into a new sheet? For example, if the word 'aged' is
only found on 130 random rows then those 130 are pasted into a new sheet as
one block of text.

Any help would be appreciated...

Thanks G

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 192
Default Selective paste

This should do the trick. You can modify the "*aged*" if you want something
more specific.

Option Explicit
Sub Select_Aged()

Dim i As Long
Dim cell As Range
i = 0

For Each cell In ActiveSheet.UsedRange
If cell Like "*aged*" Then
cell.EntireRow.Copy Destination:=Sheets("Sheet2").Range("A1").Offset(i , 0)
i = i + 1
End If
Next cell

End Sub

--
-SA


"Gordon" wrote:

Hi..

I have a block of data A9:10000 - X9:10000. Is there any code that would
allow me to select any combination of rows in which the word 'aged' is found
and then to compact them into a new sheet? For example, if the word 'aged' is
only found on 130 random rows then those 130 are pasted into a new sheet as
one block of text.

Any help would be appreciated...

Thanks G

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Selective paste


Please let us the code that would allow us to select combination of
rows/columns in which the word 'aged' or "independent" is found and
then to paste them into a new sheet with row/columnwise data also ?


ramesh

*** Sent via Developersdex http://www.developersdex.com ***
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 192
Default Selective paste

I'm sorry, that didn't make any sense. Are you wanting code where either
'aged' or 'independent' is found? If not, let me know. If so, try this:

Option Explicit
Sub Select_Aged()

Dim i As Long
Dim cell As Range
i = 0

For Each cell In ActiveSheet.UsedRange
If cell Like "*aged*" Or cell Like "independent" Then
cell.EntireRow.Copy Destination:=Sheets("Sheet2").Range("A1").Offset(i , 0)
i = i + 1
End If
Next cell

End Sub
--
-SA


"ramesh" wrote:


Please let us the code that would allow us to select combination of
rows/columns in which the word 'aged' or "independent" is found and
then to paste them into a new sheet with row/columnwise data also ?


ramesh

*** Sent via Developersdex http://www.developersdex.com ***



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Selective paste


thanks for your code.

the code is copying from one sheet to another row wise.that is ok .

please let us know the code also for copying from one sheet to another
column wise in which word "aged" and or "independent" found .

ramesh

*** Sent via Developersdex http://www.developersdex.com ***
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 192
Default Selective paste

I have it copying over to a generic "Sheet2" so you'll probably have to
change that name in the line:

cell.EntireRow.Copy Destination:=Sheets("Sheet2").Range("A1").Offset(i , 0)

Also, if you want to change from rows to columns use the following:

Option Explicit
Sub Select_Aged()

Dim i As Long
Dim cell As Range
i = 0

For Each cell In ActiveSheet.UsedRange
If cell Like "*aged*" Or cell Like "independent" Then
cell.EntireColumn.Copy Destination:=Sheets("Sheet2").Range("A1").Offset(0 , i)
i = i + 1
End If
Next cell

End Sub

--
-SA


"ramesh" wrote:


thanks for your code.

the code is copying from one sheet to another row wise.that is ok .

please let us know the code also for copying from one sheet to another
column wise in which word "aged" and or "independent" found .

ramesh

*** Sent via Developersdex http://www.developersdex.com ***

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Selective paste


Thank you !!!!!!

ramesh

*** Sent via Developersdex http://www.developersdex.com ***
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
Selective on Name stew Excel Discussion (Misc queries) 5 September 14th 08 07:53 PM
Selective calculation PH NEWS Excel Worksheet Functions 2 September 21st 06 01:33 PM
SELECTIVE DELETE [email protected] Excel Programming 2 June 15th 06 10:46 PM
Selective Data MattD Excel Programming 3 October 28th 05 07:49 PM
copy / paste selective rows Kenny Kendrena via OfficeKB.com Excel Discussion (Misc queries) 5 February 7th 05 12:55 PM


All times are GMT +1. The time now is 08:07 AM.

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"