Thread: formating macro
View Single Post
  #6   Report Post  
vishu
 
Posts: n/a
Default

Hi Don,
You are refering particular cell number i.e., B10:Q10.
I dont want to run this formating macro in any one particular Cell.
I want to run this in any rows. It can be B1:Q10, or B98:Q98 or B1001:Q1001.
In otherwords I want run in in relative references but not absolute
references.


"Don Guillett" wrote:

use this idea, in a regular module, to run from anywhere in the workbook.
Don't forget the .'s

with sheets("sheet1").range("b10:q10")
..RowHeight = 19
..Interior.ColorIndex = 40
..Borders.LineStyle = xlContinuous
..Borders.Weight = xlMedium
'.you get the idea
end with

--
Don Guillett
SalesAid Software

"vishu" wrote in message
...
Hi Don,
Can you help me to change this macro codes:

Sub formating()
Rows("10:10").Select
Range("B10").Activate
Selection.RowHeight = 19
Range("B10:K10").Select
With Selection.Interior
.ColorIndex = 6
.Pattern = xlSolid
End With
Selection.Interior.ColorIndex = 36
Range("L10:O10").Select
With Selection.Interior
.ColorIndex = 40
.Pattern = xlSolid
End With
Range("P10:Q10").Select
With Selection.Interior
.ColorIndex = 36
.Pattern = xlSolid
End With
Range("Q10").Select
Range(Selection, Selection.End(xlToLeft)).Select
Rows("10:10").Select
Range("Q10").Activate
With Selection.Font
.Name = "Tahoma"
.FontStyle = "Regular"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
Range("B10:Q10").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 15
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 15
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 15
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 15
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 15
End With
End Sub


I want to run this macro in different rows. please help me.
regards
vishu


"Don Guillett" wrote:

As always, post YOUR coding efforts for comments.

--
Don Guillett
SalesAid Software

"vishu" wrote in message
...
Hi,
I have problem in macro codes.
I have recorded macro for rows formatting. For recording a macro I

have
chosen line no.22.
After recording a macro I want to run this in line different rows, say

for
example line no. 50. But whenever I run this It will go to line no.22

and
formatting.
How to change macro codes..I don't want to give particular cell number

in
macro codes.
I want to run this in different cells every time.
Please advise me.?

Regards,
Vishu