i am using this macro to copy cells which have been selected via checkboxes. The cells start in A1 but when they are pasted into output they are found in cell A10000 odd where i need them to be in A1. Is there something i am missing here.
Also when it is copying the cells over i am copying the entire row where i just need the info in the A column when selected. can anyone assist please
thanks
Sub MoveRowBasedOnCellValue()
'Updated by Extendoffice 2017/11/10
Dim xRg As Range
Dim xCell As Range
Dim I As Long
Dim J As Long
Dim K As Long
I = Worksheets("Email Template").UsedRange.Rows.Count
J = Worksheets("Output").UsedRange.Rows.Count
If J = 1 Then
If Application.WorksheetFunction.CountA(Worksheets("Output").UsedRange) = 0 Then J = 0
End If
Set xRg = Worksheets("Email Template").Range("C1:C" & I)
On Error Resume Next
Application.ScreenUpdating = False
For K = 1 To xRg.Count
If CStr(xRg(K).Value) = "True" Then
xRg(K).EntireRow.Copy Destination:=Worksheets("Output").Range("A" & J + 1)
J = J + 1
End If
Next
End Sub
Also when it is copying the cells over i am copying the entire row where i just need the info in the A column when selected. can anyone assist please
thanks
Sub MoveRowBasedOnCellValue()
'Updated by Extendoffice 2017/11/10
Dim xRg As Range
Dim xCell As Range
Dim I As Long
Dim J As Long
Dim K As Long
I = Worksheets("Email Template").UsedRange.Rows.Count
J = Worksheets("Output").UsedRange.Rows.Count
If J = 1 Then
If Application.WorksheetFunction.CountA(Worksheets("Output").UsedRange) = 0 Then J = 0
End If
Set xRg = Worksheets("Email Template").Range("C1:C" & I)
On Error Resume Next
Application.ScreenUpdating = False
For K = 1 To xRg.Count
If CStr(xRg(K).Value) = "True" Then
xRg(K).EntireRow.Copy Destination:=Worksheets("Output").Range("A" & J + 1)
J = J + 1
End If
Next
End Sub