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

i have golf records on sheet 1 in column A i have course name scores, putts,
ect. in the adjacent columns. I need a vba code to cut and paste each course
data on a different sheet. For example have all of Course 1 data on sheet 2
all of Course 2 data on sheet 3 ect.

Please help
Todd
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default vba cut and paste


Ideally your code should do the following!
1. first do an auto filter on the main sheet which contains all th
data.
This can be done by code similar to

Selection.AutoFilter Field:=ColNum, Criteria1:=FiltCriteria

2. copy the filtered data to another sheet.

Sub CopyFilter()
Dim Rng As Range, FiltRng As Range
With ActiveSheet.AutoFilter.Range
On Error Resume Next
Set FiltRng = .Offset(1, 0).Resize(.Rows.Count - 1, 1) _
.SpecialCells(xlCellTypeVisible)
On Error GoTo 0
End With
If FiltRng Is Nothing Then
MsgBox "No Records Found"
Else
'clear report range (modify this suitably)
Worksheets("Report").Range("A4:K" & Cells(Rows.Count
2).End(xlUp).Row).Clear

'filter and copy to report sheet
Set Rng = ActiveSheet.AutoFilter.Range
Rng.Offset(1, 0).Resize(Rng.Rows.Count - 1).Copy _
Destination:=Worksheets("Report").Range("A4")
End If
'remove auto filter from main sheet
ActiveSheet.ShowAllData
End Sub



If you are not sure, do a search for Autofilter+help

--
lotu
-----------------------------------------------------------------------
lotus's Profile: http://www.excelforum.com/member.php...fo&userid=2375
View this thread: http://www.excelforum.com/showthread.php?threadid=49503

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
Paste and Paste Special No Longer Working - Excel 2003 SheriJ Excel Discussion (Misc queries) 2 January 15th 09 09:23 PM
In Excel: add a Paste-Special Option to paste IN REVERSE ORDER. stan-the-man Excel Worksheet Functions 7 June 14th 06 08:10 PM
Excel cut/Paste Problem: Year changes after data is copy and paste Asif Excel Discussion (Misc queries) 2 December 9th 05 05:16 PM
Copy and Paste macro needs to paste to a changing cell reference loulou Excel Programming 0 February 24th 05 10:29 AM
Macro to Paste to specific line, and continue to Paste each time on next row not over tomkarakowski[_2_] Excel Programming 1 May 28th 04 06:50 PM


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