I've been trying to work this out for a while. How can I copy certain column from one sheet to another if the first cell with value in that column is for example "Cell". My guesses are false but maybe it will be helpful to better understand what I'm trying to accomplish.
for i=5 to lcol
if Sheet8(6,i).value ="Cell" then
Sheet8.Range(6,i).Copy Destination:=Sheet7.Range("M3:N" & lRow)
end if
next i
Change your copy statement from:
Sheet8.Range(6,i).Copy Destination:=Sheet7.Range("M3:N" & lRow)
To:
ThisWorkbook.Worksheets("Sheet8").Range(6, i).EntireColumn.Copy ThisWorkbook.Worksheets("Sheet7").Range("M3")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.