Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Find end of number and copy/paste 5 columns

Hi all,

I am having trouble with removing some data before inserting it into a
pivot table. In column g of my excel database, i have shift -trip
numbers in the following format XXXXXXX-X. Where all X's are numbers.
My issue is that I need to find all shift-trip numbers that end in -1
and copy and paste them to a new page, these are the entries I need
for further analysis. Any ideas on how to recognize the end "-1"? I
am not having luck with anything I've seen online so far, though I am
very new to vb.

Thanks in advance,
Kyle
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Find end of number and copy/paste 5 columns

Kyle,

Not sure which 5 columns for want, or where you want the cells copied, but code like this will do
it. I assumed that your database sheet is Sheet1, and you are copying to Sheet2 to the bottom of
column A, and you want column G, H, I, J, and K copied.

Dim myR As Range
Set myR = Intersect(Worksheets("Sheet1").Range("G:G"), _
Worksheets("Sheet1").UsedRange)
myR.AutoFilter Field:=1, Criteria1:="=*-1"
myR.Offset(1, 0).Resize(myR.Rows.Count - 1, 5). _
SpecialCells(xlCellTypeVisible).Copy _
Worksheets("Sheet2").Cells(Rows.Count, 1).End(xlUp)(2)
myR.AutoFilter
Application.CutCopyMode = False


HTH,
Bernie
MS Excel MVP


wrote in message
...
Hi all,

I am having trouble with removing some data before inserting it into a
pivot table. In column g of my excel database, i have shift -trip
numbers in the following format XXXXXXX-X. Where all X's are numbers.
My issue is that I need to find all shift-trip numbers that end in -1
and copy and paste them to a new page, these are the entries I need
for further analysis. Any ideas on how to recognize the end "-1"? I
am not having luck with anything I've seen online so far, though I am
very new to vb.

Thanks in advance,
Kyle



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 and Paste [email protected] New Users to Excel 0 July 3rd 07 02:10 PM
Find/Copy/paste.. then Find/Paste - not working ... at all.... [email protected] Excel Programming 9 November 30th 06 08:49 PM
Find, copy and paste ufo_pilot Excel Discussion (Misc queries) 3 September 7th 06 10:34 AM
Find Copy and Paste RigasMinho Excel Programming 4 July 17th 06 09:32 PM


All times are GMT +1. The time now is 06:48 AM.

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"