Consulta macro formularios-guardar datos
Una consulta, diseñé un formulario para el registro de proveedores en la hoja llamada principal. Quiero que los datos registrado se guarden en la hoja llamada proveedores a partir de la celda c3 y así sucesivamente en las siguientes columnas.
Además, en algunos casos el formulario ofrece múltiples opciones, y use combo box y option button.. No sé como trabajar con dichas opciones para copiar los datos en la hoja proveedor. Intenté avanzar, sin embargo, no sé si lo estoy haciendo bien.
Agradeciendo su ayuda.
Sub GrabaCorrectoProveedor()
Sheets("Proveedor").Select
Range("C" + Range("C1").Text).Value = TextBox9.Text
Range("D" + Range("C1").Text).Value = TextBox2.Text
Range("E" + Range("C1").Text).Value = TextBox3.Text
Range("F" + Range("C1").Text).Value = OptionButton1.Text
Range("F" + Range("C1").Text).Value = OptionButton2.Text
Range("G" + Range("C1").Text).Value = ComboBox2.Text
Range("G" + Range("C1").Text).Value = ComboBox3.Text
Range("H" + Range("C1").Text).Value = TextBox6.Text
Range("I" + Range("C1").Text).Value = TextBox8.Text
Range("J" + Range("C1").Text).Value = TextBox7.Text
Range("C1").Value = Range("C1").Value + 1
TextBox9.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
OptionButton1.Text = ""
OptionButton2.Text = ""
ComboBox2.Text = ""
ComboBox3.Text = ""
TextBox6.Text = ""
TextBox8.Text = ""
TextBox7.Text = ""
End Sub
Además, en algunos casos el formulario ofrece múltiples opciones, y use combo box y option button.. No sé como trabajar con dichas opciones para copiar los datos en la hoja proveedor. Intenté avanzar, sin embargo, no sé si lo estoy haciendo bien.
Agradeciendo su ayuda.
Sub GrabaCorrectoProveedor()
Sheets("Proveedor").Select
Range("C" + Range("C1").Text).Value = TextBox9.Text
Range("D" + Range("C1").Text).Value = TextBox2.Text
Range("E" + Range("C1").Text).Value = TextBox3.Text
Range("F" + Range("C1").Text).Value = OptionButton1.Text
Range("F" + Range("C1").Text).Value = OptionButton2.Text
Range("G" + Range("C1").Text).Value = ComboBox2.Text
Range("G" + Range("C1").Text).Value = ComboBox3.Text
Range("H" + Range("C1").Text).Value = TextBox6.Text
Range("I" + Range("C1").Text).Value = TextBox8.Text
Range("J" + Range("C1").Text).Value = TextBox7.Text
Range("C1").Value = Range("C1").Value + 1
TextBox9.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
OptionButton1.Text = ""
OptionButton2.Text = ""
ComboBox2.Text = ""
ComboBox3.Text = ""
TextBox6.Text = ""
TextBox8.Text = ""
TextBox7.Text = ""
End Sub
1 Respuesta
Respuesta de antares18