![]() |
Posting code with IF
The following code is only part of larger posting process. I require
assistance for this posting to be done only if DG77 is NOT i.e. there must be value, zero is not a value. Additional info, the formula in DG77 is =IF($DF$8=1,$DF$3,) DF3 has a positive number all the time. Set CopyRng = _ Sheets("Sheet2").Range("DG77", "DH77") Set DestRng = _ Sheets("Sheet1").Cells(65536, "F").End(xlUp).Offset(1, 0) i = 0 For Each cell In CopyRng DestRng.Offset(0, i).Value = cell i = i + 2 Next Similar postings (without conditions) take place before and after the process above. Thank you. -- Robert |
Posting code with IF
what about:
If Sheets("Sheet2").Range("DF8").Value = 1 Then Set CopyRng = _ Sheets("Sheet2").Range("DG77", "DH77") Set DestRng = _ Sheets("Sheet1").Cells(65536, "F").End(xlUp).Offset(1, 0) i = 0 For Each cell In CopyRng DestRng.Offset(0, i).Value = cell i = i + 2 Next End If Hope this helps Rowan Robert wrote: The following code is only part of larger posting process. I require assistance for this posting to be done only if DG77 is NOT i.e. there must be value, zero is not a value. Additional info, the formula in DG77 is =IF($DF$8=1,$DF$3,) DF3 has a positive number all the time. Set CopyRng = _ Sheets("Sheet2").Range("DG77", "DH77") Set DestRng = _ Sheets("Sheet1").Cells(65536, "F").End(xlUp).Offset(1, 0) i = 0 For Each cell In CopyRng DestRng.Offset(0, i).Value = cell i = i + 2 Next Similar postings (without conditions) take place before and after the process above. Thank you. |
Posting code with IF
will this work for you?
If Range("DG77") = "" Or Range("dg77") = 0 Then ' do nothing Else 'do something your code here End If -- Gary "Robert" wrote in message ... The following code is only part of larger posting process. I require assistance for this posting to be done only if DG77 is NOT "" i.e. there must be value, zero is not a value. Additional info, the formula in DG77 is =IF($DF$8=1,$DF$3,"") DF3 has a positive number all the time. Set CopyRng = _ Sheets("Sheet2").Range("DG77", "DH77") Set DestRng = _ Sheets("Sheet1").Cells(65536, "F").End(xlUp).Offset(1, 0) i = 0 For Each cell In CopyRng DestRng.Offset(0, i).Value = cell i = i + 2 Next Similar postings (without conditions) take place before and after the process above. Thank you. -- Robert |
Posting code with IF
Thank you Rowan.
-- Robert |
Posting code with IF
You're welcome!
Robert wrote: Thank you Rowan. |
Posting code with IF
Thank you Gary, I tried yours after Rowans.
Special thanks to Rowan and Gary for being so fast. -- Robert |
Posting code with IF
you're welcome, as long as it worked<g
hopefully it worked out ok. -- Gary "Robert" wrote in message ... Thank you Gary, I tried yours after Rowans. Special thanks to Rowan and Gary for being so fast. -- Robert |
Posting code with IF
Gary, of course it works, Rowans as well. I do not know any VBA and had to
shift the "End If" by trial and error. -- Robert |
All times are GMT +1. The time now is 11:45 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com