#1
|
|||
|
|||
Extract the filter data
Hi,
I am using below code to extract the filter data, but it is giving probolem. can any one help me to resolve the same. Code:
Private Sub CommandButton1_Click() Sheet1.Activate Sheet1.Range("A1,G1").Select Selection.Copy Sheets("Sheet4").Select Range("A1:B1").PasteSpecial Columns("A:A").EntireColumn.AutoFit Columns("B:B").EntireColumn.AutoFit Range("C4").Select Sheets("Sheet1").Select Application.CutCopyMode = False Sheet1.Range("A3").Select Sheets("Sheet4").Select Sheets("Sheet1").Range("A1:G9").AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=Sheets("Sheet1").Range("I1:I2"), CopyToRange:=Sheets("Sheet4").Range("A1:B1"), Unique:=False End Sub Last edited by macropod; 10-25-2015 at 06:19 PM. Reason: Added code tags |
#2
|
||||
|
||||
Please wrap code with code tags - Thx
__________________
Did you know you can thank someone who helped you? Click on the tiny scale in the right upper hand corner of your helper's post |
#3
|
|||
|
|||
You don't say what the problem is but probably Sheet1 and Sheets("Sheet4") being the same sheet could have something to do with it.
In the VBA environment have a look at the Excel Objects for sheets. The name on the left is the code name of the sheet and the name in brackets is the tab name. Need to decide which you are going to use and be consistent. |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Vba to Filter data | saurabhlotankar | Excel Programming | 5 | 05-29-2015 06:07 AM |
Extract Excel Data from Chart in Word | cillianmccolgan | Word | 1 | 08-15-2014 01:42 AM |
Extract data from web - Take a long time | edneco | Excel Programming | 11 | 06-28-2014 05:54 PM |
How to Extract key data from word | iliauk | Word | 3 | 11-08-2013 04:37 PM |