Hi,
I am trying to rearrange columns and rows in a worksheet. I am using below code to automate the process. It worked seamlessly when I ran the code on same worksheet. However when I cut and paste to another worksheet It doesn't run properly.
It want to cut cell E3 and F3 from Sta Sheet and copy to Worksheet.(Summary").Range B4:B11, and B12:B19. However below code only paste it to B4 and B12. Can anyone help me modify the code so it paste to entire range.
Worksheet Sta is Source Data
Worksheet Summary is where i want to cut and paste the ranges.
Code:
Sub MoveRangeSta()
Dim iCntr
Dim rng As Range
Set rng = Worksheets("Summary").Range("C4:F1111")
For iCntr = rng.Row + rng.Rows.Count - 1 To rng.Row Step -1
If Application.WorksheetFunction.CountA(Rows(iCntr)) = 0 Then Rows(iCntr).EntireRow.Delete
Next
Worksheets("Sta").Range("C4:C12").Cut Destination:=Worksheets("Summary").Range("C4")
Worksheets("Sta").Range("E4:E12").Cut Destination:=Worksheets("Summary").Range("D4")
Worksheets("Sta").Range("C4:C12").Cut Destination:=Worksheets("Summary").Range("C12")
Worksheets("Sta").Range("F4:F12").Cut Destination:=Worksheets("Summary").Range("D12")
Worksheets("Sta").Range("E3").Cut Destination:=Worksheets("Summary").Range("B4:B11")
I posted this on another forum below is the link.
Worksheets("Sta").Range("F3").Cut Destination:=Worksheets("Summary").Range("B12:B19")
End Sub
I am trying to rearrange columns and rows in a worksheet. I am using below code to automate the process. It worked seamlessly when I ran the code on same worksheet. However when I cut and paste to another worksheet It doesn't run properly.
It want to cut cell E3 and F3 from Sta Sheet and copy to Worksheet.(Summary").Range B4:B11, and B12:B19. However below code only paste it to B4 and B12. Can anyone help me modify the code so it paste to entire range.
Worksheet Sta is Source Data
Worksheet Summary is where i want to cut and paste the ranges.
Code:
Sub MoveRangeSta()
Dim iCntr
Dim rng As Range
Set rng = Worksheets("Summary").Range("C4:F1111")
For iCntr = rng.Row + rng.Rows.Count - 1 To rng.Row Step -1
If Application.WorksheetFunction.CountA(Rows(iCntr)) = 0 Then Rows(iCntr).EntireRow.Delete
Next
Worksheets("Sta").Range("C4:C12").Cut Destination:=Worksheets("Summary").Range("C4")
Worksheets("Sta").Range("E4:E12").Cut Destination:=Worksheets("Summary").Range("D4")
Worksheets("Sta").Range("C4:C12").Cut Destination:=Worksheets("Summary").Range("C12")
Worksheets("Sta").Range("F4:F12").Cut Destination:=Worksheets("Summary").Range("D12")
Worksheets("Sta").Range("E3").Cut Destination:=Worksheets("Summary").Range("B4:B11")
I posted this on another forum below is the link.
Cut single cell and paste to another worksheet range
Hi, I am trying to rearrange columns and rows in a worksheet. I am using below code to automate the process. It worked seamlessly when I ran the code on same worksheet. However when I cut and paste to another worksheet It doesn't run properly. It cut c ell E3 and F3 from Sta Sheet however it...
chandoo.org
Worksheets("Sta").Range("F3").Cut Destination:=Worksheets("Summary").Range("B12:B19")
End Sub