Hi!
I have a question using macros:
I'm working on this macro, it's a form to save data from maintenance inspection, and as far everything has been working well with the code but now I have this problem that I suspect is pretty easy to solve but I'm new to VBA Programming. So, I have this code, I'm not going to write it completly because it's too long but goes like this:
Sub GuardarInformacion()
Dim contFila As Long
Dim hoja As Worksheet
Set hoja = Worksheets(1)
contFila = hoja.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
hoja.Cells(contFila, 1).Value = ComboBox11.Value & Me.TextBox4.Value
hoja.Cells(contFila, 2).Value =
hoja.Cells(contFila, 3).Value = Me.TextBox2.Value
hoja.Cells(contFila, 4).Value = ComboBox11.Value
hoja.Cells(contFila, 5).Value = Me.TextBox4.Value
hoja.Cells(contFila, 6).Value = ComboBox12.Value
(...)
End Sub
But now I need to save pictures too, I already wrote that part, and works perfectly fine in the form:
Private Sub CommandButton10_Click()
insertar4
End Sub
Sub insertar4()
Dim foto As Variant
foto = Application.GetOpenFilename(FileFilter:= _
"Imagen (*.gif;*.jpg;*.jpeg;*.bmp), *.gif;*.jpg;*.jpeg;*.bmp", _
Title:="Seleccionar imagen", MultiSelect:=False)
If foto = False Then
Exit Sub
End If
Image18.Picture = LoadPicture(foto)
Image18.PictureSizeMode = fmPictureSizeModeStretch
End Sub
So with this line I can upload images to my form, but now I need the image that I already upload in the form to be save on the cell next to the data continously. What I mean is if the last line of the code is:
hoja.Cells(contFila, 6).Value = ComboBox12.Value
End Sub
which is in the column 6, I need the picture to be saved in the column 7 everytime I click to save the data. I don't now if I've made myself understood but I hope you can help me!
****** id="cke_pastebin" style="position: absolute; top: 808px; width: 1px; height: 1px; overflow: hidden; left: -1000px;">I do not know if I've made myself understood</body>
I have a question using macros:
I'm working on this macro, it's a form to save data from maintenance inspection, and as far everything has been working well with the code but now I have this problem that I suspect is pretty easy to solve but I'm new to VBA Programming. So, I have this code, I'm not going to write it completly because it's too long but goes like this:
Sub GuardarInformacion()
Dim contFila As Long
Dim hoja As Worksheet
Set hoja = Worksheets(1)
contFila = hoja.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
hoja.Cells(contFila, 1).Value = ComboBox11.Value & Me.TextBox4.Value
hoja.Cells(contFila, 2).Value =
hoja.Cells(contFila, 3).Value = Me.TextBox2.Value
hoja.Cells(contFila, 4).Value = ComboBox11.Value
hoja.Cells(contFila, 5).Value = Me.TextBox4.Value
hoja.Cells(contFila, 6).Value = ComboBox12.Value
(...)
End Sub
But now I need to save pictures too, I already wrote that part, and works perfectly fine in the form:
Private Sub CommandButton10_Click()
insertar4
End Sub
Sub insertar4()
Dim foto As Variant
foto = Application.GetOpenFilename(FileFilter:= _
"Imagen (*.gif;*.jpg;*.jpeg;*.bmp), *.gif;*.jpg;*.jpeg;*.bmp", _
Title:="Seleccionar imagen", MultiSelect:=False)
If foto = False Then
Exit Sub
End If
Image18.Picture = LoadPicture(foto)
Image18.PictureSizeMode = fmPictureSizeModeStretch
End Sub
So with this line I can upload images to my form, but now I need the image that I already upload in the form to be save on the cell next to the data continously. What I mean is if the last line of the code is:
hoja.Cells(contFila, 6).Value = ComboBox12.Value
End Sub
which is in the column 6, I need the picture to be saved in the column 7 everytime I click to save the data. I don't now if I've made myself understood but I hope you can help me!
****** id="cke_pastebin" style="position: absolute; top: 808px; width: 1px; height: 1px; overflow: hidden; left: -1000px;">I do not know if I've made myself understood</body>