Transfer data from one sheet to another using macro

Lux Aeterna

Board Regular
Joined
Aug 27, 2015
Messages
205
Office Version
  1. 2019
Platform
  1. Windows
Hello again!

I have got an excel file that contains two sheets.
The first one, named Appointments, contains demographic data, such as name, age etc.
IDΟνοματεπώνυμοΗλικίαΑΜΚΑΤ.Ε.Ρ.ΥποκατάστημαΗ.Λ.Ε.
1person 1616582145825431/12/2021place A05/05/2022
2person 2613252841296329/12/2021place B07/03/2022
3person 3572147823654129/12/2021place C21/08/2022
4person 4689874336658029/12/2021place D14/01/2022

The second one, named Results, draws these demographic data from the Appointments sheet, through an IF function, using each person's ID.

1658399203285.png


On the same sheet, there are also some cells that allow manual changes to the above data (instead of drawing them from the Appointments sheet. So, if the person who fills in the Results sheet finds a mistake, e.g. in the name, they can edit it.

1658399344134.png


What I would like is to have a macro to transfer those edits to the Appointments sheet as well.

For example, if the name on ID 1 is written as George instead of Gerogia, the person will correct it (using column AA), it will appear on the results form (line 5), but I also want it to change on the Appointments sheet as well, so as not to have to transfer it myself manually.

I'd rather not have an automated process that runs on the background, but a macro that I'll assign a button to it. If that's possible, I can give you the ranges and all other relevant info.

Hope my message makes sense :)🤞🙏
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
I always say: if you can do it by hand, you can do it using a macro. This should be easy to accomplish
 
Upvote 0
Absolutely!

And I always say to my colleagues who blame our PC for whatever goes wrong: Computers don't make mistakes. People do!

By the way, in case you're working on it, I've created another thread for this one.

You can find it here!
 
Upvote 0
Thanks a lot!

Please work on this code, as I'd like them to run together.

VBA Code:
Sub Αποθήκευση()
    Application.ScreenUpdating = False
    Dim ID As Range, sup As String, sID As String
    If Sheets("Test pap").Range("U2") = "" Then
        MsgBox ("Το ID δεν μπορεί να είναι κενό")
        Sheets("Test pap").Range("U2").Select
        Exit Sub
    End If
    If Sheets("Test pap").Range("AA9") = "" Then
        MsgBox ("Το κίτρινο κελί δεν μπορεί να είναι κενό")
        Sheets("Test pap").Range("U3").Select
        Exit Sub
    End If
    Set ID = Sheets("Ραντεβού").Range("A:A").Find(Sheets("Test pap").Range("U2").Value, LookIn:=xlValues, lookat:=xlWhole)
    If Not ID Is Nothing Then
        ID.Offset(, 1) = Sheets("Test pap").Range("AB9")
    End If
    ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, FileName:="C:\Users\pc50\Desktop\New results\" & Range("AH1").Value _
        , Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=True
    Application.ScreenUpdating = True
End Sub
 
Upvote 0
The results table on the Results sheet, is it 4 columns wide? screenshot would help
 
Upvote 0
What do I do with the date from the correction table (first cell)?
 
Upvote 0
The results table on the Results sheet, is it 4 columns wide? screenshot would help
This is the results table on the Results sheet (printable area). The yellow cells are the ones with the formulas I use to draw data from the Appointments sheet. I think you won't need to do anything with it.
1660464219892.png


It's the correction table that I'd rather to be copied to the Appointments sheet.
Cell AA3 to the respective cell (according to ID - U2) in column C in the Appointments sheet.
Cell AA4 ... in column E
Cell AA5 ... in column I
Cell AA6 ... in column H
Cell AA7 ... in column F
Cell AA8 ... in column G

AA9 is already copied to column B using the macro above. It would be very helpful though if you could modify it a bit. When the respective cell in column B is already filled in, I'd like to have a pop up message to ask for confirmation. For example, "Cell B52 is already completed. Do you want to overwrite it?"

Thank you once again!
 

Attachments

  • 1660464095649.png
    1660464095649.png
    15 KB · Views: 12
Upvote 0
I understood that the correction table needs to be transferred. But I need to know on which row, so that is why I need the information in the results table. But I see there is also an ID in U2, so I can use that to quickly find the correct row.

I will include the overwriting of column B.
Thanks for the info
 
Upvote 0

Forum statistics

Threads
1,224,824
Messages
6,181,187
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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