ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA noob help with an IF (https://www.excelbanter.com/excel-programming/302649-vba-noob-help-if.html)

duster

VBA noob help with an IF
 
I am wanting to create something that will copy the row to anothe
workbook if i put true in the first column of that row

i figured if i did a for loop for each row i want to check then an i
to look at the column to see if it is true if it is then copy it to th
other workbook

i recoreded a macro for the copy and paste and have modified it i hav
also found some really good exambles of for loops that i think i ca
make work but the if statement i am having many problems with

thanks for your hel

--
Message posted from http://www.ExcelForum.com


MSP77079[_17_]

VBA noob help with an IF
 
I don't understand the problem. Perhaps you can post some of the cod
that is giving you problems

--
Message posted from http://www.ExcelForum.com


Tom Ogilvy[_12_]

VBA noob help with an IF
 
Assume us column B to determine the extent of your data

Assume destination is Book2.xls, first worksheet.

Sub CopyTrueRows()

Dim rng as Range, cell as Range
set rng = Range(Cells(1,2),Cells(row.count,2).end(xlup))

for each cell in rng
if cell.offset(0,-1) = True then
cell.EntireRow.copy Destination:= _
workbooks("Book2.xls").Worksheets(1) _
..Cells(rows.count,1).end(xlup)
end if
Next

End Sub
--
regards,
Tom Ogilvy


---
Message posted from http://www.ExcelForum.com/



All times are GMT +1. The time now is 09:36 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com