Transferring Data to a Spreadsheet

To transfer the data from the textboxes on the form to the cells on the spreadsheet, we can use Offset:
ActiveCell.Value = tbImageName.Text
ActiveCell.Offset(, 1).Value = tbDateTaken.Text
ActiveCell.Offset(, 2).Value = tbInfo.Text
ActiveCell.Offset(, 3).Value = tbDimensions.Text
ActiveCell.Offset(, 4).Value = tbImageSize.Text
To the right of the equal sign, we have the name of a textbox followed by the Text property. To the left of the equal signs, we have ActiveCell . The first one is the cell that is currently selected, the one in the A column. We can put the image name in here. The other four have Offset values. We use Offset for the columns because we want to go across filling each cell.
To get the value from the Camera ComboBox, we can access the Text property, just like we did for the textboxes:
ActiveCell.Offset(, 5).Value = ComboBox1.Text
To get the correct value from the option buttons, the code is slightly more complex. It's this:
If OptionButton3.Value = True Then
ActiveCell.Offset(, 6).Value = "Yes"
ElseIf OptionButton4.Value = True Then
ActiveCell.Offset(, 6).Value = "No"
End If
Here, we have an If … ElseIf Statement. We're testing OptionButton3 and OptionButton4 for a value of True. Our OptionButton3 is the Yes option, while OptionButton4 is the No option. Depending on which option button was selected, we put either Yes or No in the ActiveCell that has an Offset column of 6.
There's only one more thing left to do now and that's copy the image over to the images folder.