halimi1306
04-13-2011, 07:31 PM
Hi pals,
Could some one help me with my code. I want data from other sheets to be merge in master sheet as value only without formating. The code below return data to master sheet along with formating.
Code:
Sub AllDataToForthSheet()
Dim SheetCtr As Double
Dim Last1Row As Double
Dim LastShtRow As Double
For SheetCtr = 5 To ActiveWorkbook.Sheets.Count
LastShtRow = Worksheets(SheetCtr).Cells(Rows.Count, "D").End(xlUp).Row
If Worksheets(SheetCtr).Cells(Rows.Count, "J").End(xlUp).Row > LastShtRow Then
LastShtRow = Worksheets(SheetCtr).Cells(Rows.Count, "G").End(xlUp).Row
End If
Last1Row = Worksheets(4).Cells(Rows.Count, "F").End(xlUp).Row
If Worksheets(4).Cells(Rows.Count, "G").End(xlUp).Row > Last1Row Then
Last1Row = Worksheets(4).Cells(Rows.Count, "J").End(xlUp).Row
End If
Worksheets(SheetCtr).Range("D25:S" & LastShtRow).Copy _
Destination:=Worksheets(4).Range("F" & Last1Row + 1)
Next SheetCtr
End Sub
Could some one help me with my code. I want data from other sheets to be merge in master sheet as value only without formating. The code below return data to master sheet along with formating.
Code:
Sub AllDataToForthSheet()
Dim SheetCtr As Double
Dim Last1Row As Double
Dim LastShtRow As Double
For SheetCtr = 5 To ActiveWorkbook.Sheets.Count
LastShtRow = Worksheets(SheetCtr).Cells(Rows.Count, "D").End(xlUp).Row
If Worksheets(SheetCtr).Cells(Rows.Count, "J").End(xlUp).Row > LastShtRow Then
LastShtRow = Worksheets(SheetCtr).Cells(Rows.Count, "G").End(xlUp).Row
End If
Last1Row = Worksheets(4).Cells(Rows.Count, "F").End(xlUp).Row
If Worksheets(4).Cells(Rows.Count, "G").End(xlUp).Row > Last1Row Then
Last1Row = Worksheets(4).Cells(Rows.Count, "J").End(xlUp).Row
End If
Worksheets(SheetCtr).Range("D25:S" & LastShtRow).Copy _
Destination:=Worksheets(4).Range("F" & Last1Row + 1)
Next SheetCtr
End Sub