ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro for adding rows if two different columns have a value (https://www.excelbanter.com/excel-programming/442495-macro-adding-rows-if-two-different-columns-have-value.html)

Saveset

Macro for adding rows if two different columns have a value
 
Help! I need a macro to add a row after if the cell in column F has a value
and again if there is a value in column G

JLGWhiz[_2_]

Macro for adding rows if two different columns have a value
 
For Each c In Range("F2:F20") 'Or whatever size range
If c.Value "" And c.Offset(0, 1).Value 1 Then
c.Offset(1, 0).Resize(2, 1).EntireRow.Insert
ElseIf c.Value "" Then
c.Offset(1, 0).EntireRow.Insert
End If
Next




"Saveset" wrote in message
...
Help! I need a macro to add a row after if the cell in column F has a
value
and again if there is a value in column G




Saveset

Macro for adding rows if two different columns have a value
 
Thank you JLGWhiz! You are a Time saver for me! Also I appreciate the help
since I am just learning about the VBA process.

"JLGWhiz" wrote:

For Each c In Range("F2:F20") 'Or whatever size range
If c.Value "" And c.Offset(0, 1).Value 1 Then
c.Offset(1, 0).Resize(2, 1).EntireRow.Insert
ElseIf c.Value "" Then
c.Offset(1, 0).EntireRow.Insert
End If
Next




"Saveset" wrote in message
...
Help! I need a macro to add a row after if the cell in column F has a
value
and again if there is a value in column G



.


Saveset

Macro for adding rows if two different columns have a value
 
Thanks! This did exactly what I needed!!! I truely appreciate this since I am
just beginning to learn about Macros!

"JLGWhiz" wrote:

For Each c In Range("F2:F20") 'Or whatever size range
If c.Value "" And c.Offset(0, 1).Value 1 Then
c.Offset(1, 0).Resize(2, 1).EntireRow.Insert
ElseIf c.Value "" Then
c.Offset(1, 0).EntireRow.Insert
End If
Next




"Saveset" wrote in message
...
Help! I need a macro to add a row after if the cell in column F has a
value
and again if there is a value in column G



.



All times are GMT +1. The time now is 09:55 AM.

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