Macro for inserting blank row based on a 8 value in cell

October 30, 2013 at 06:44:57
Specs: Windows 7
I am making a timesheet in Excel. I want to insert a row beneath my active cell if the value is less than 8. Range is N13:N28. If the macro could copy the the formating and fourmulas from the row above but not the values that would be good otherwise just a blank row will work.

See More: Macro for inserting blank row based on a 8 value in cell

Report •

#1
October 30, 2013 at 09:33:27
Try this...

Select a cell in your N13:N28 range.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
 If Target.Cells.Count = 1 Then
  If Not Intersect(Range("N13:N28"), Target) Is Nothing Then
   If Target < 8 Then
    Target.EntireRow.Copy
     With Rows(Target.Row + 1)
       .Insert shift:=xlDown
       .ClearContents
     End With
   End If
  End If
 End If
End Sub

Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.


Report •

#2
October 30, 2013 at 13:09:36
I pasted your code into VBA and nothing seemed to happen. when I hit the run button it brings up the macro run box to select a different macro. Any ideas?

Report •
Related Solutions


Ask Question