VBA - Transferring certain columns of data to another sheet that meet a criteria

NathanA

New Member
Joined
Jan 18, 2017
Messages
34
I am using code to transfer data that don't have a blank cell in column A from "Data" to "ForIndustry". While the code works, I would like to only transfer columns A:P rather than the whole row. Any guidance would be much appreciated.

Code:
Sub transfer()
Set i = Sheets("Data")
Set e = Sheets("ForIndustry")
Dim d
Dim j
d = 1
j = 2


Do Until IsEmpty(i.Range("B" & j))


If i.Range("A" & j) <> "" Then
d = d + 1
e.Rows(d).Value = i.Rows(j).Value
End If
j = j + 1
Loop
End Sub
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Code:
  'e.Rows(d).Value = i.Rows(j).Value
  e.Range(e.Cells(d, "A"), e.Cells(d, "P")).Value = _
   i.Range(i.Cells(j, "A"), i.Cells(j, "P")).Value
 
Upvote 0
Of course the more efficient solution would be to use AutoFilter and copy the visible Specialcells.
 
Upvote 0
Is it possible to add a condition (whether column E is >= to 1st July 2017) to the below

Rich (BB code):
'If i.Range("A" & j) <> "" Then 


 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,196
Members
452,616
Latest member
intern444

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