Copy pictures that user uploads to a "Database" sheet before clearing form, using VBA

Aliensrnear

New Member
Joined
Oct 6, 2021
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Good morning everyone,

I am making a new sheet to use at work so that multiple users can record any errors or issues on the production floor into a "log" that can be referenced later. Filling out the text cells and having them transfer, NO ISSUES whatsoever. Something I'm trying to implement is the ability to upload a picture so that we can reference it in the future if we ever run into the same issues. I am able to insert a picture to the three cells, as you can see in the picture I've uploaded with this. What I am needing help on as I'm just kind of lost right now, is how can I copy these pictures and put them into the database? I want to put them in the cells in the same row at the end.

Here is what I have in vba to get the text cells to copy over:
Select Case machine

Case "Trumpf Laser"

Range("A3:AB3").Copy
Sheets("Trumpf Database").Select

Do While (IsEmpty(Range("A" & emptyrow))) = False
emptyrow = emptyrow + 1
Loop

Range("A" & emptyrow).PasteSpecial Paste:=xlPasteValues
Range("A" & emptyrow).PasteSpecial Paste:=xlPasteFormats

Sheets("Main").Select


ClearForm

I will mention that I am fairly new at VBA in general, and one of my biggest obstacles in this has been copy and pasting. I can never figure out a .paste command or something that will work that easy. I appreciate any thought or help with this! Let me know what you think.

*I am having difficulty uploading images to this website. Hopefully I'm allowed to post a link to get around this:

What is the file size max? It says my images are too large, but they are less than 600kb each.
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Also! This is what I have in my ClearForm Sub:

Dim xPicRg As Range
Dim xPic As Picture
Dim xRg As Range
Set xRg = Range("A5:AA6")

For Each xPic In ActiveSheet.Pictures
Set xPicRg = Range(xPic.TopLeftCell.Address & ":" & xPic.BottomRightCell.Address)
If Not Intersect(xRg, xPicRg) Is Nothing Then xPic.delete
Next

This is deleting the pictures on the main page and clears the form perfectly! I've tried using this in the Submit sub with some adjustments but have been unsuccessful in copy/pasting.
 
Upvote 0

Forum statistics

Threads
1,214,987
Messages
6,122,613
Members
449,090
Latest member
vivek chauhan

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top