Guest User

Untitled

a guest
Jul 16th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. Column A Column B Column C
  2.  
  3.  
  4. Header 1 detail detail
  5. detail detail
  6. Count
  7.  
  8.  
  9.  
  10. Header 2 detail detail
  11. detail detail
  12. Count
  13.  
  14.  
  15. Grand Total
  16.  
  17. Column A Column B Column C
  18.  
  19.  
  20. Header 1 detail detail
  21. detail detail
  22. Count
  23.  
  24.  
  25.  
  26. Header 2 detail detail
  27. detail detail
  28. Count
  29.  
  30.  
  31.  
  32. Header 3 detail detail
  33. detail detail
  34. Count
  35.  
  36.  
  37. Grand Total
  38.  
  39. Private m_intHeaderCount As Integer
  40.  
  41. Sub InsertRow()
  42. Dim intRowToInsert As Integer
  43. m_intHeaderCount = m_intHeaderCount + 1
  44. intRowToInsert = ((m_intHeaderCount - 1) * 3) + 1
  45. Rows(CStr(intRowToInsert) & ":" & CStr(intRowToInsert)).Select
  46. Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
  47. Range("A" & CStr(intRowToInsert + 1)).Select
  48. ActiveCell.FormulaR1C1 = "Column " & CStr(m_intHeaderCount)
  49. Range("A1").Select
  50. End Sub
Add Comment
Please, Sign In to add comment