ap27 Posted May 16, 2012 at 07:34 PM Report #456187 Posted May 16, 2012 at 07:34 PM Boa tarde, sou novo disto de programar no excel, mas consegui desenvolver uma folha de calculo que faz tudo o que eu quero, no entanto estou com um problema, no caso de ter muita informação, vou necessitar de escrever muito, então o que eu queria era um botão que ao ser carregado me escrevesse determinadas coisas em células diferentes, será que isso é possível de programar..? e já agora por onde começar. Obrigado
Gnrtuga Posted May 16, 2012 at 08:38 PM Report #456205 Posted May 16, 2012 at 08:38 PM (edited) Sim é possivel 🙂 eu por exemplo tenho uma folha que tenho que preencher até ao quinto dos infernos, mas as células são preenchidas conforme cada situação, então criei um form e meti-lhe o seguinte código: Private Sub iva() Dim ultimalinha As Long Dim ultimalinha2 As Long Dim ultimalinha3 As Long listaviat = cbestadoviatura.ListIndex ultimalinha = Folha1.Cells(65536, 1).End(xlUp).Row + 1 Folha1.Cells(ultimalinha, 1).Value = "Iva" Folha1.Cells(ultimalinha, 2).Value = cbinfracaoiva.Text Folha1.Cells(ultimalinha, 3).Value = numauto.Text Folha1.Cells(ultimalinha, 4).Value = vmercadoria.Text Folha1.Cells(ultimalinha, 5).Value = datainf.Text Folha1.Cells(ultimalinha, 6).Value = horainf.Text Folha1.Cells(ultimalinha, 7).Value = matriculaf.Text Folha1.Cells(ultimalinha, 8).Value = cbestadoviatura.Text Folha1.Cells(ultimalinha, 9).Value = localinf.Text Folha1.Cells(ultimalinha, 10).Value = cbfreguesia.Text Folha1.Cells(ultimalinha, 13).Value = nifinfratorf.Text Folha1.Cells(ultimalinha, 15).Value = caef.Text Folha1.Cells(ultimalinha, 19).Value = cbautuante.Text Folha1.Cells(ultimalinha, 21).Value = "IVA" Folha1.Cells(ultimalinha, 42).Value = "1" Folha1.Cells(ultimalinha, 45).Value = vtapreendida.Text Folha1.Cells(ultimalinha, 46).Value = cbpais.Text Folha1.Cells(ultimalinha, 47).Value = cbtipoviatura.Text Folha1.Cells(ultimalinha, 48).Value = cbmarca.Text ... em que o número corresponde à coluna, sendo 1= a 2= b... Edited May 16, 2012 at 08:41 PM by anolsi Férias! Estou por aqui: http://maps.google.p...001549&t=h&z=20 (a bulir claro está!) Nunca mais é verão outra vez.. :)
jpaulino Posted May 16, 2012 at 09:11 PM Report #456216 Posted May 16, 2012 at 09:11 PM ... e já agora por onde começar. Tens aqui alguma coisa e em Português: http://www.jorgepaulino.com/search/label/VBA Vê alguns artigos mais simples para começar (eventos, ciclos, etc) 😉
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