good, i tried this way, but i don´t like the results because it´s hard to define the last row to format
Sub tabela() ' ' tabela Macro ' ' Range("A7").Select Range(Selection, Selection.End(xlToRight)).Select With Selection.Borders(xlEdgeTop) .LineStyle = xlContinuous .ColorIndex = 0 .TintAndShade = 0 .Weight = xlThin End With With Selection.Borders(xlEdgeBottom) .LineStyle = xlDouble .ColorIndex = 0 .TintAndShade = 0 .Weight = xlThick End With Range(Selection, Selection.End(xlToRight)).Select Range(Selection, Selection.End(xlDown)).Select With Selection.Borders(xlEdgeTop) .LineStyle = xlContinuous .ColorIndex = 0 .TintAndShade = 0 .Weight = xlThin End With With Selection.Borders(xlEdgeBottom) .LineStyle = xlcontinous .ColorIndex = 0 .TintAndShade = 0 .Weight = xlThin End With Range("A7").Select Range(Selection, Selection.End(xlToRight)).Select Range(Selection, Selection.End(xlDown).End(xlDown)).Select With Selection.Borders(xlEdgeTop) .LineStyle = xlContinuous .ColorIndex = 0 .TintAndShade = 0 .Weight = xlThin End With With Selection.Borders(xlEdgeBottom) .LineStyle = xlcontinous .ColorIndex = 0 .TintAndShade = 0 .Weight = xlThin End With Range("A7").Select Range(Selection, Selection.End(xlToRight)).Select Range(Selection, Selection.End(xlDown).End(xlDown).End(xlDown)).Select With Selection.Borders(xlEdgeTop) .LineStyle = xlContinuous .ColorIndex = 0 .TintAndShade = 0 .Weight = xlThin End With With Selection.Borders(xlEdgeBottom) .LineStyle = xlcontinous .ColorIndex = 0 .TintAndShade = 0 .Weight = xlThin End With End Sub 2011/6/27 Vasant <vasant...@gmail.com> > did u try > > Range("A1048576").end(xlup).row '-- to get the last populated row in > column A > > > On Mon, Jun 27, 2011 at 3:58 PM, Jorge Marques <leote.w...@gmail.com> > wrote: > > > > Hi guys i need your expertise, i have this macro and i need your advise, > i just need to format the excel like i put in the example to format the > cells with line upperlines around all data and only in the cells filled in > column A. this is my code so far, i know to macro it, but the format of > table keeps changing, i tried to do it with range select and xldown and > right but it stops on the first non empty cell and doesn´t continue!1000 > thanks > > > > Sub copycash() > > Dim ws As Worksheet > > Sheets("Pivot Cash").Select > > Sheets("Pivot Cash").UsedRange.Copy > > Windows("Comparsheet.xlsx").Activate > > For Each ws In Worksheets > > If ws.UsedRange.Cells.Count < 1 Then ws.Delete > > Next ws > > Application.DisplayAlerts = True > > Set ws = Worksheets.Add(After:=Sheets(Sheets.Count)) > > 'ws.Name = ActiveSheet.Name > > With ws > > ws.Range("A1").PasteSpecial Paste:=xlPasteValues > > End With > > Cells.Select > > Selection.NumberFormat = "#,##0_ ;[Red]-#,##0 " > > Range("A1").Select > > Selection.Font.Size = 14 > > Selection.Font.Bold = True > > Selection.Borders(xlDiagonalDown).LineStyle = xlNone > > Selection.Borders(xlDiagonalUp).LineStyle = xlNone > > With Selection.Borders(xlEdgeLeft) > > .LineStyle = xlContinuous > > .ColorIndex = 0 > > .TintAndShade = 0 > > .Weight = xlMedium > > End With > > With Selection.Borders(xlEdgeTop) > > .LineStyle = xlContinuous > > .ColorIndex = 0 > > .TintAndShade = 0 > > .Weight = xlMedium > > End With > > With Selection.Borders(xlEdgeBottom) > > .LineStyle = xlContinuous > > .ColorIndex = 0 > > .TintAndShade = 0 > > .Weight = xlMedium > > End With > > With Selection.Borders(xlEdgeRight) > > .LineStyle = xlContinuous > > .ColorIndex = 0 > > .TintAndShade = 0 > > .Weight = xlMedium > > End With > > Selection.Borders(xlInsideVertical).LineStyle = xlNone > > Selection.Borders(xlInsideHorizontal).LineStyle = xlNone > > Range("A1").Select > > Cells.EntireColumn.AutoFit > > Application.CutCopyMode = False > > > > > > > > > > > > > > > > -- > > > ---------------------------------------------------------------------------------- > > Some important links for excel users: > > 1. Follow us on TWITTER for tips tricks and links : > http://twitter.com/exceldailytip > > 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 > > 3. Excel tutorials at http://www.excel-macros.blogspot.com > > 4. Learn VBA Macros at http://www.quickvba.blogspot.com > > 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com > > > > To post to this group, send email to excel-macros@googlegroups.com > > > > <><><><><><><><><><><><><><><><><><><><><><> > > Like our page on facebook , Just follow below link > > http://www.facebook.com/discussexcel > > > > -- > Regards > > Vasant > > skype Id: vasantjob > vasant...@gmail.com > > -- > > ---------------------------------------------------------------------------------- > Some important links for excel users: > 1. Follow us on TWITTER for tips tricks and links : > http://twitter.com/exceldailytip > 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 > 3. Excel tutorials at http://www.excel-macros.blogspot.com > 4. Learn VBA Macros at http://www.quickvba.blogspot.com > 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com > > To post to this group, send email to excel-macros@googlegroups.com > > <><><><><><><><><><><><><><><><><><><><><><> > Like our page on facebook , Just follow below link > http://www.facebook.com/discussexcel > -- ---------------------------------------------------------------------------------- Some important links for excel users: 1. Follow us on TWITTER for tips tricks and links : http://twitter.com/exceldailytip 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 3. Excel tutorials at http://www.excel-macros.blogspot.com 4. Learn VBA Macros at http://www.quickvba.blogspot.com 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com <><><><><><><><><><><><><><><><><><><><><><> Like our page on facebook , Just follow below link http://www.facebook.com/discussexcel