Line Insert recall by name

  • Thread starter FIRSTROUNDKO via OfficeKB.com
  • Start date
F

FIRSTROUNDKO via OfficeKB.com

H!!

Is it possible to name the below code extract and recall it by the name?

Rows("5:5").Select
Selection.Insert Shift:=xlDown
Range("A5:M5").Select
Selection.NumberFormat = "0.00"
Selection.Interior.ColorIndex = xlNone
Range("A5").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.ShrinkToFit = False
.MergeCells = False
.Interior.ColorIndex = 15
End With

Thanks in advance

Darren
 
G

Guest

Sub insertrow(rownum)
Rows(rownum).Select
Selection.Insert Shift:=xlDown
Range("A" & rownum & ":M" & rownum).Select
Selection.NumberFormat = "0.00"
Selection.Interior.ColorIndex = xlNone
Range("A" & rownum).Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.ShrinkToFit = False
.MergeCells = False
.Interior.ColorIndex = 15
End With
End Sub

Usage:
Sub insteszt()
rowvar=5
Call insertrow(rowvar)
End Sub

Regards,
Stefi


„FIRSTROUNDKO via OfficeKB.com†ezt írta:
 
J

Jim Cone

Function ChangeCells()
Rows("5:5").Insert Shift:=xlDown
Range("A5:M5").NumberFormat = "0.00"
Range("A5:M5").Interior.ColorIndex = xlNone
With Range("A5")
.MergeCells = False
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.ShrinkToFit = False
.Interior.ColorIndex = 15
End With
End Function

Sub DoStuff()
'lots of stuff
Call ChangeCells
'do more stuff
End Sub
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware


"FIRSTROUNDKO via OfficeKB.com" <u15639@uwe>
wrote in message
H!!
Is it possible to name the below code extract and recall it by the name?

Rows("5:5").Select
Selection.Insert Shift:=xlDown
Range("A5:M5").Select
Selection.NumberFormat = "0.00"
Selection.Interior.ColorIndex = xlNone
Range("A5").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.ShrinkToFit = False
.MergeCells = False
.Interior.ColorIndex = 15
End With

Thanks in advance
Darren
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top