Vba copy data to other sheet

ste33uka

Active Member
Joined
Jan 31, 2020
Messages
473
Office Version
  1. 365
Platform
  1. Windows
Hi could someone help me add the follwing to this code ?
So that if column TL has an 'x' it would copy range.


if LCase(.Range("Tl81").Value) = "x" Then
.Range("TL81:Tx81").Copy Sheets("COPY").Range("NU" & Rows.Count).End(xlUp).Offset(1)
if LCase(.Range("Tl82").Value) = "x" Then
.Range("TL82:Tx82").Copy Sheets("COPY").Range("NU" & Rows.Count).End(xlUp).Offset(1)


VBA Code:
Sub copy()
   Dim i As Long
  
   For i = 1 To 60
      With Sheets(CStr(i))
         If LCase(.Range("TL80").Value) = "x" Then
            .Range("TL80:Tx80").Copy Sheets("COPY").Range("NU" & Rows.Count).End(xlUp).Offset(1)
         End If
      End With
   Next i
End Sub
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
VBA Code:
Sub copy2()
   Dim i As Long
   For i = 1 To 60
      With Sheets(CStr(i))
          For j = 80 To 82
             If LCase(.Range("TI" & j).Value) = "x" Then
                .Range("TL" & j).Resize(, 13).copy Sheets("COPY").Range("NU" & Rows.Count).End(xlUp).Offset(1)
             End If
          Next
      End With
   Next i
End Sub
 
Upvote 0
Hi could someone please tweak this code so it would also copy blank cells to destination sheet.
Thanks
VBA Code:
Sub copy2()
   Dim i As Long
   For i = 1 To 60
      With Sheets(CStr(i))
          For j = 80 To 82
             If LCase(.Range("TI" & j).Value) = "x" Then
                .Range("TL" & j).Resize(, 13).copy Sheets("COPY").Range("NU" & Rows.Count).End(xlUp).Offset(1)
             End If
          Next
      End With
   Next i
End Sub
 
Upvote 0
Hi could someone please tweak this code so it would also copy blank cells to destination sheet.

You need to explain this better because it currently copies whatever is in (or not ii if blank) cells from columns TL to TX. Can you give an illustration of what you expect?
 
Upvote 0
sorry my mistake , everything seems to work correctly now, thanks
 
Upvote 0

Forum statistics

Threads
1,216,853
Messages
6,133,087
Members
449,778
Latest member
dep1969

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top