Tiago Simões Posted April 26, 2013 at 03:01 PM Report #504936 Posted April 26, 2013 at 03:01 PM Boa tarde, eu criei recorrendo ao savefiledialog, um ficheiro excel onde gravo os valores que pretendo. Até aqui tudo bem consigo colocar os meus valores uso a seguinte programação: Excel.workbooks(1).worksheets(1).cells(1, 1).value = "Resistance" Conseguem me ajudar por exemplo a por a negrito o texto "Resistance", ou a aumentar a largura da célula?? Também pretendia conseguir por os limites nas linhas e colunas e mais para a frente executar um gráfico mediante os valores.. Obrigado
Tiago Simões Posted April 26, 2013 at 03:31 PM Author Report #504944 Posted April 26, 2013 at 03:31 PM Para formatar as larguras e alturas das células é: Excel.Columns.AutoFit() Excel.rows.AutoFit() Para o resto sugestões?? já tentei com size e resize.. e por ai fora mas ta-me a faltar algo..
acao Posted April 26, 2013 at 04:02 PM Report #504947 Posted April 26, 2013 at 04:02 PM boas http://www.jorgepaulino.com/2008/03/formatao-condicional-expandida-em-excel.HTML http://www.jorgepaulino.com/2011/02/excel-verifica-cor-na-formatacao.HTML http://www.jorgepaulino.com/2008/07/excel-formatar-grficos-dinamicamente.HTML cumps acao
Tiago Simões Posted April 26, 2013 at 06:57 PM Author Report #504961 Posted April 26, 2013 at 06:57 PM Vou analisar porque sou novo nisto e preciso de mais algum tempo.. Obrigado se tiver mais duvidas depois volto a colocar. Cumprimentos,
Tiago Simões Posted April 27, 2013 at 11:11 AM Author Report #504993 Posted April 27, 2013 at 11:11 AM Já tive a ver consegui aproveitar alguma coisa.. Mas não é bem o que queria.. eu to a a criar uma folha totalmente do zero com o visual basic e criei de uma forma que não consigo usar codigo como xl.. ou range.. Neste momento consigo usar linhas de comando do genero: " ' Excel.workbooks(1).worksheets(1).cells(2, 2).value = "Tension Zone" Excel.workbooks(1).worksheets(1).cells(2, 1).value = "Ft,Rd" Excel.workbooks(1).worksheets(1).cells(4, 3).value = Ftbolts Excel.workbooks(1).worksheets(1).cells(2, 3).value = "KN/m" Excel.workbooks(1).worksheets(1).cells(2, 3).font.bold = True ' Excel.workbooks(1).worksheets(1).cells(1, 1).font.bold = True Excel.workbooks(1).worksheets(1).cells(2, 2).font.color = RGB(0, 255, 0) ' Excel.workbooks(1).worksheets(1).cells(1, 1).font.size = 14 'Excel.workbooks(1).worksheets(1).cells(1, 1).font.themecolor = 5 'Excel.workbooks(1).worksheets(1).cells(1, 1).font.underline = True Excel.workbooks(1).worksheets(1).cells(2, 3).Borders.LineStyle = True " Mas ainda tenho duas duvidas.. primeiro como defino de forma semelhante à de cima os limites (borders) so das posições que pretendo. A segunda é como consigo juntar duas células em linguagem que a minha folha possa aceitar.. Obrigado..
acao Posted April 27, 2013 at 09:48 PM Report #505020 Posted April 27, 2013 at 09:48 PM (edited) boas sem range não sei, ou dás a volta para teres acesso ao range ou espera por alguém que te dê a dica. tenta declarar uma variável como range talvez dê. deixo aqui uns exemplos de como utilizar: Private Sub UnirCelulas_Click() 'Talvez este funcione ActiveWorkbook.Sheets("FormatarPag").Activate Dim linh As Range Set linh = Union(Cells(3, 1), Cells(3, 2)) linh.Merge End Sub 'para unir Range("G1:H1").Merge Private Sub cmdFormatBordas_Click() ActiveWorkbook.Sheets("FormatarPag").Activate Dim linha As Range Dim linh As Range 'Set linh = Union(Rows(1), Rows(2)) Set linha = Range("C15:E18") linha.Borders(xlEdgeTop).LineStyle = 12 'xlNone (fica sem borda ) linha.Borders(xlEdgeRight).LineStyle = 12 'xlContinuous (fica?) linha.Borders(xlEdgeBottom).LineStyle = 12 linha.Borders(xlEdgeLeft).LineStyle = 12 linha.Borders(xlEdgeTop).Color = 45 linha.Merge linha.Cells.UnMerge 'linh.Borders.Color = 10 'linha.Borders.Color = 15 End Sub Private Sub cmdTamanhoRowCuln_Click() ActiveWorkbook.Sheets("FormatarPag").Activate Dim RangColl As Range Set RangColl = Range("D1:E1") RangColl.Value = Array("C", "D") With RangColl .Value = Array("A", "B") .ColumnWidth = 12 'Largura das colunas .RowHeight = 24 'largura das linhas .Font.Name = "Times New Roman" .Font.Size = 16 .Font.Bold = True 'Negrito .Font.Underline = True 'Sublinhado .Font.Italic = True 'Itálico .Font.FontStyle = True 'Retorna negrito a notmal .Style = "Normal" 'coloca a fonte em normal .HorizontalAlignment = xlRight 'Direita .HorizontalAlignment = xlLeft 'esquerda .HorizontalAlignment = xlCenter 'centro .VerticalAlignment = xlBottom 'inferior .VerticalAlignment = xlTop 'Superior .VerticalAlignment = xlCenter 'centro End With End Sub Private Sub cmdUnirCelulas_Click() ActiveWorkbook.Sheets("FormatarPag").Activate Dim unircelula As Range Set unircelula = Range("A2:C2") unircelula.Select With Selection .HorizontalAlignment = xlCenter .VerticalAlignment = xlBottom .WrapText = False .Orientation = 0 .AddIndent = False .IndentLevel = 0 .ShrinkToFit = False .ReadingOrder = xlContext .MergeCells = False End With Selection.Merge With Selection.Interior '.ColorIndex = 15 .Pattern = xlSolid End With 'Selection.Font.ColorIndex = 2 End Sub cumps acao Edited April 27, 2013 at 10:14 PM by acao
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now