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

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
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,225,737
Messages
6,186,722
Members
453,369
Latest member
positivemind

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