Insert rows based on cell value (simple VBA, I assume...?)
Closed
newbie28
Posts
1
Registration date
Wednesday August 21, 2013
Status
Member
Last seen
August 21, 2013
-
Aug 21, 2013 at 04:15 AM
mm - Nov 13, 2014 at 06:49 AM
mm - Nov 13, 2014 at 06:49 AM
Related:
- Insert rows based on cell value (simple VBA, I assume...?)
- Vba case like - Guide
- Insert draft watermark in word on all pages - Guide
- Insert key on laptop - Guide
- Insert check mark in word - Guide
- How to insert photo in word for resume - Guide
1 response
Good afternoon, My morning has been busy or I would have responded earlier. I really hope this isnt a school project.
Sub insert()
Dim x
Dim rws
Dim magicstart
Dim startrange
magicstart = 22
startrange = "F" & CStr(magicstart)
Range(startrange).Select
rws = Selection.Value
Rows(CStr(magicstart + 1)).Select
For x = 0 To rws - 1
Selection.insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Range("B" & CStr(magicstart + 1 + x) & ":" & "E" & CStr(magicstart + 1 + x)).Select
With Selection.Borders
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Next
End Sub
Please take a look and you may very well have to make changes for it to work EXACTLY how you wish. The point is, it is a good start.
Sub insert()
Dim x
Dim rws
Dim magicstart
Dim startrange
magicstart = 22
startrange = "F" & CStr(magicstart)
Range(startrange).Select
rws = Selection.Value
Rows(CStr(magicstart + 1)).Select
For x = 0 To rws - 1
Selection.insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Range("B" & CStr(magicstart + 1 + x) & ":" & "E" & CStr(magicstart + 1 + x)).Select
With Selection.Borders
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Next
End Sub
Please take a look and you may very well have to make changes for it to work EXACTLY how you wish. The point is, it is a good start.
Nov 13, 2014 at 06:49 AM