![]() |
HELP w/ Macro and IF Statement
I am needing to have a macro look at a Cell (B8) and determine if it ha a value greater than 0. IF it does I need it to copy the contents t another cell (M8) then move down 4 cells and repete IF the value i "======" then I am done. Can somone PLEASE help me with this -- randy_t ----------------------------------------------------------------------- randy_tn's Profile: http://www.excelforum.com/member.php...fo&userid=1600 View this thread: http://www.excelforum.com/showthread.php?threadid=27471 |
HELP w/ Macro and IF Statement
Something like this should be close to what you're looking for. You didn't
state whether or not the copied values will be copied into column M in the same row as the original value in column B, but I made that assumption. The loop below will terminate if either the cell value contains the string "======" (6 equal signs bounded by double quotes) or the cell is empty. Regards, Phil Webb Sub CopyPositiveVals() Dim cel As Range Set cel = Range("B8") Do If cel.Value 0 Then Cells(cel.Row, 13).Value = cel.Value End If Set cel = cel.Offset(4, 0) Loop Until cel.Value = Chr(34) & "======" & Chr(34) Or IsEmpty(cel)End Sub "randy_tn" wrote in message ... I am needing to have a macro look at a Cell (B8) and determine if it has a value greater than 0. IF it does I need it to copy the contents to another cell (M8) then move down 4 cells and repete IF the value is "======" then I am done. Can somone PLEASE help me with this? -- randy_tn ------------------------------------------------------------------------ randy_tn's Profile: http://www.excelforum.com/member.php...o&userid=16001 View this thread: http://www.excelforum.com/showthread...hreadid=274716 |
All times are GMT +1. The time now is 09:16 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com