Jump to content

Recommended Posts

Posted

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

Posted (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 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.. :)

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.