Notifications
Clear all

Cadastro de dados atraves de Formulário

4 Posts
2 Usuários
0 Reactions
905 Visualizações
(@fernandofernandes)
Posts: 43750
Illustrious Member
Topic starter
 

tenho uma planilha onde faço cadastro de alguns dados;
preencho 43 textbox ; clico em um botao gravar e o mesmo grava em células especificas como a seguir.

Private Sub CmdGravIten_Click()
Plan3.Visible = xlSheetVisible

      Sheets("DadosContratuais").Select      
    Range("F30").Value = txtNContr.Value
    Range("H30").Value = txtDatIni.Value
    Range("I30").Value = txtDatFin.Value
    Range("K30").Value = txtVrUS.Value
    Range("G30").Value = txtEmpres.Value
    Range("J30").Value = txtRepres.Value
    Range("L30").Value = txtCodEmp.Value
Range("M30").Value = TextBox1.Value
Range("N30").Value = TextBox2.Value
Range("O30").Value = TextBox3.Value
Range("P30").Value = TextBox4.Value
Range("Q30").Value = TextBox5.Value
Range("R30").Value = TextBox6.Value
Range("S30").Value = TextBox7.Value
Range("T30").Value = TextBox8.Value
Range("U30").Value = TextBox9.Value
Range("V30").Value = TextBox10.Value
Range("W30").Value = TextBox11.Value
Range("X30").Value = TextBox12.Value
Range("Y30").Value = TextBox13.Value
Range("Z30").Value = TextBox14.Value
Range("AA30").Value = TextBox15.Value
Range("AB30").Value = TextBox16.Value
Range("AC30").Value = TextBox17.Value
Range("AD30").Value = TextBox18.Value
Range("AE30").Value = TextBox19.Value
Range("AF30").Value = TextBox20.Value
Range("AG30").Value = TextBox21.Value
Range("AH30").Value = TextBox22.Value
Range("AI30").Value = TextBox23.Value
Range("AJ30").Value = TextBox24.Value
Range("AK30").Value = TextBox25.Value
Range("AL30").Value = TextBox26.Value
Range("AM30").Value = TextBox27.Value
Range("AN30").Value = TextBox28.Value
Range("AO30").Value = TextBox29.Value
Range("AP30").Value = TextBox30.Value
Range("AQ30").Value = TextBox31.Value
Range("AR30").Value = TextBox32.Value
Range("AS30").Value = TextBox33.Value
Range("AT30").Value = TextBox34.Value
Range("AU30").Value = TextBox35.Value
Range("AV30").Value = TextBox36.Value

Plan1.Visible = xlSheetVisible
Plan3.Visible = xlSheetVeryHidden
      Sheets("RESUMO").Select

O que preciso fazer agora é tornar o local de gravação variavel.
Fazer tipo um Procv ; onde vai procurar o valor de $J$4 da Planilha Resumo ; na planilha DADOS de A3:AV29 , e gravar na linha onde for encontrado o valor de $J$4 .

PROCV(RESUMO!$J$4;A3:AV29;) grava Range("AV & linha encontrada").Value = TextBox36.Value
PROCV(RESUMO!$J$4;A3:AV29;) grava Range("AU & linha encontrada").Value = TextBox35.Value
PROCV(RESUMO!$J$4;A3:AV29;) grava Range("AT & linha encontrada").Value = TextBox35.Value

É isso , mas não sei como escrever.
Tem como fazer isso? Peço o favor de quem for me ajudar , que 'comente o código , para que eu possa não só conseguir fazer mas principalmente aprender.

Desde já meu muito obrigado.

 
Postado : 16/06/2015 2:20 pm
(@fernandofernandes)
Posts: 43750
Illustrious Member
Topic starter
 

up

 
Postado : 17/06/2015 10:45 am
(@fernandofernandes)
Posts: 43750
Illustrious Member
Topic starter
 

Complicado ? Ou me compliquei mal?

 
Postado : 17/06/2015 7:29 pm
(@edcronos)
Posts: 1006
Noble Member
 

Além de pouca informação, está muito confuso
todos já tem suficiente trabalho para lidar com as próprias ideias, imagine ter que ficar decifrando oq se passa pela cabeça dos outros?

para conseguir ajuda vai ter que colocar uma planilha de exemplo com alguns dados e de maneira manual um exemplo de como quer que fique

 
Postado : 17/06/2015 7:57 pm