Hi,
Require help in below.
the above code allows me to copy the data to sheet2 "the code is huge so not able to past every thing"
'now appling the filter crateria on the sheet2 and past the data on sheet3
till here have no problem
now after data is pasted on the sheet 3 from sheet 2 i need to go back to the sheet 2 change filter criteria and past the data to sheet4. which i am not able to do so.
Also need copy some columns only from sheet2 but the entire sheet gets pasted to the sheet3
The problem is i need to copy the data from sheet2 to sheet3 sheet4 sheet5 and sheet6 with different filter Criteria.
I also need to copy only some specific columns from sheet2 to sheet3.
please can some one help me it is urgent ......
Require help in below.
Code:
Option Explicit
Sub CopyColumnByTitle()
Dim t As Range, rng As Range
'Replace India with ind
Columns("F:F").Select
Selection.Replace What:="India", Replacement:="ind", lookat:= _
xlWhole, SearchOrder:=xlByRows, MatchCase:=True, SearchFormat:=False, _
ReplaceFormat:=False
'Replace Blank cells with NY
Columns("F:F").Select
Selection.Replace What:="", Replacement:="NY", lookat:= _
xlWhole, SearchOrder:=xlByRows, MatchCase:=True, SearchFormat:=False, _
ReplaceFormat:=False
'-------------------------------------------
With Sheets(1).Rows(1)
Set t = .Find("Name", lookat:=xlPart)
If Not t Is Nothing Then
Sheets(1).Columns(t.Column).EntireColumn.Copy _
Destination:=Sheets(2).Columns(1)
Else
MsgBox "Title Not Found"
Exit Sub
End If
End With
'-------------------------------------------
With Sheets(1).Rows(1)
Set t = .Find("Version", lookat:=xlPart)
If Not t Is Nothing Then
Sheets(1).Columns(t.Column).EntireColumn.Copy _
Destination:=Sheets(2).Columns(2)
Else
MsgBox "Title Not Found"
Exit Sub
End If
End With
'-------------------------------------------
With Sheets(1).Rows(1)
Set t = .Find("Address", lookat:=xlPart)
If Not t Is Nothing Then
Sheets(1).Columns(t.Column).EntireColumn.Copy _
Destination:=Sheets(2).Columns(3)
Else
MsgBox "Title Not Found"
Exit Sub
End If
End With
the above code allows me to copy the data to sheet2 "the code is huge so not able to past every thing"
Code:
'now appling the filter crateria on the sheet2 and past the data on sheet3
'~~> This will filter the data for names which equals Hary and John
With Sheets(2).Range("B1")
.AutoFilter Field:=1, Criteria1:="=Hary", _
Operator:=xlOr, Criteria2:="=John"
'~~> Copy the filtered range to sheet 3
With Sheets(2).AutoFilter.Range
On Error Resume Next
Set rng = .Range("A1") _
.SpecialCells(xlCellTypeVisible)
On Error GoTo 0
If Not rng Is Nothing Then rng.Copy Sheets(3).Range("A1")
End With
End With
till here have no problem
now after data is pasted on the sheet 3 from sheet 2 i need to go back to the sheet 2 change filter criteria and past the data to sheet4. which i am not able to do so.
Also need copy some columns only from sheet2 but the entire sheet gets pasted to the sheet3
Code:
With Sheets(2).Range("J1")
.AutoFilter Field:=10, Criteria1:="=Analyst - Query Raised"
'~~> Copy the filtered range to sheet 3
With Sheets(2).AutoFilter.Range
On Error Resume Next
Set rng = .Range("A1") _
.SpecialCells(xlCellTypeVisible)
On Error GoTo 0
If Not rng Is Nothing Then rng.Copy Sheets(4).Range("A1")
End With
End With
End Sub
The problem is i need to copy the data from sheet2 to sheet3 sheet4 sheet5 and sheet6 with different filter Criteria.
I also need to copy only some specific columns from sheet2 to sheet3.
please can some one help me it is urgent ......