Macro-Range of rows and columns to copy
Closed
onearth70s
-
Dec 15, 2009 at 04:06 AM
venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 - Dec 15, 2009 at 09:38 AM
venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 - Dec 15, 2009 at 09:38 AM
Related:
- Macro-Range of rows and columns to copy
- How to delete rows and columns in word - Guide
- Display two columns in data validation list but return only one - Guide
- Spell number in excel without macro - Guide
- Tweetdeck larger columns - Guide
- Apple airtag range - Guide
2 responses
venkat1926
Posts
1863
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
August 7, 2021
811
Dec 15, 2009 at 06:53 AM
Dec 15, 2009 at 06:53 AM
I have not seen your macro. after filtering use specialcells(xlcellstypevisible)--something like this
ActiveSheet.UsedRange.Cells.SpecialCells(xlCellTypeVisible).Copy
Range("a15").PasteSpecial
ActiveSheet.UsedRange.Cells.SpecialCells(xlCellTypeVisible).Copy
Range("a15").PasteSpecial
venkat1926
Posts
1863
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
August 7, 2021
811
Dec 15, 2009 at 09:38 AM
Dec 15, 2009 at 09:38 AM
Have tried my suggestion. when you MERELY select a filtered data selection includes the hidden cells also (hidden due to filtering ) instead you must use "specialcells" property as suggested my me. can you modify on that basis.
There is also a provision WITHOUT activating the different windows or selecting diferent ranges.
I have giving alternative for pastespecial portion of your macro
if the two books are saved books you should use "book4.xls" or "book4.xlsm""
thisworkbook means the workbook's module where the macro is parked
can you try to modify the macro .
There is also a provision WITHOUT activating the different windows or selecting diferent ranges.
I have giving alternative for pastespecial portion of your macro
ThisWorkbook.Worksheets("sheet1").UsedRange.SpecialCells(xlCellTypeVisible).Copy Workbooks("book4").Worksheets("sheet1").Range("A1").PasteSpecial Paste:=xlPasteValues, Paste:=xlPasteColumnWidths, Paste:=xlPasteFormats _ , Paste:=xlPasteColumnWidths
if the two books are saved books you should use "book4.xls" or "book4.xlsm""
thisworkbook means the workbook's module where the macro is parked
can you try to modify the macro .
Dec 15, 2009 at 07:57 AM
Sub Macro1()
'
' Macro21 Macro
'
'
Workbooks.Open Filename:= _
"O:\data\order\refList-output.xltx" _
, Editable:=True
Selection.CurrentRegion.Select
Selection.Clear
Range("A1").Select
Windows("ReferenceList.xlsm").Activate
Selection.CurrentRegion.Select
Selection.Copy
Windows("refList-output.xltx").Activate
Selection.PasteSpecial Paste:=xlPasteColumnWidths, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("A1").Select
Application.CutCopyMode = False
ActiveWorkbook.Save
Windows("ReferenceList.xlsm").Activate
Range("Table_Query_from_MS_Access_Database[#Headers,[Order No]]").Select
End Sub
it is doing fine but have to make selection based on result records, so that can do other formating as well.
thanks