ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Line Insert recall by name (https://www.excelbanter.com/excel-programming/373976-line-insert-recall-name.html)

FIRSTROUNDKO via OfficeKB.com

Line Insert recall by name
 
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

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200609/1


Stefi

Line Insert recall by name
 
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:

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

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200609/1



Jim Cone

Line Insert recall by name
 
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



All times are GMT +1. The time now is 01:38 PM.

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