Excel VBA to Save Data to Another Workbook

VBA/Macros Course (40% Discount): www.teachexcel.com/vba-course...
200+ Video Tutorials - 200+ Downloadable Excel Reference Files - 50+ Hours of Content
Downloadable File: Available in the VBA course.
I walk you through every step required to seamlessly use VBA/Macros to save data into a separate workbook and then close and save that workbook.
In this tutorial, I show you a setup that is easy to follow, manage, and apply to your situation.
The main things that you will learn in this tutorial include:
- Referencing workbooks using variables.
- Opening workbooks using VBA.
- Moving data between multiple workbooks in VBA.
- Closing workbooks using VBA.
- Saving workbooks using VBA.
This is a smaller version of the tutorial for my VBA course on TeachExcel.com and I hope you find it helpful :)
Excel Courses:
- VBA/Macro Course: www.teachexcel.com/vba-course...
- Building Professional Forms: www.teachexcel.com/premium-co...
TeachExcel.com
#excel #vba #tutorial

Пікірлер: 35

  • @timparke3305
    @timparke33053 жыл бұрын

    Exactly what I was looking for... Thank You!!!!

  • @darrylmorgan
    @darrylmorgan3 жыл бұрын

    Really Nice Simple Bit Of VBA Code Thumbs Up...Thank You Sir :)

  • @abhishekshrivastava3893
    @abhishekshrivastava3893 Жыл бұрын

    Thanks a lot for this!!!

  • @wishboneattack
    @wishboneattack3 жыл бұрын

    If you want to be sure it saved instead of just a msgbox that is basically telling you the macro has ended, you can add an IF statement using the two lines he already gave you to do a simple verification check. Put this right above wbMaster.Close True IF wbMaster.Worksheets("Data".Cells(masterNextRow, 1).Value = wbLocal.Worksheets("Input").Range("F3"). Value And wbMaster.Worksheets("Data").Cells(masterNextRow, 2).Value = wbLocal.Worksheets("Input").Range("F5).Value Then MsgBox "Part Saved" Else MsgBox "Part not saved correctly" End IF

  • @TeachExcel

    @TeachExcel

    2 жыл бұрын

    Very nice!!! :)

  • @wayneedmondson1065
    @wayneedmondson10653 жыл бұрын

    Fun one! I hacked out my own solution before watching the video. Picked up some good tips from your detailed lesson. Thanks for sharing. Thumbs up!!

  • @MohAboAbdo
    @MohAboAbdo2 жыл бұрын

    Thank you so mutch

  • @AzharyRahim
    @AzharyRahim9 ай бұрын

    thank you, with little adjustment i'm able to finish my work

  • @shaiquenasir
    @shaiquenasir2 жыл бұрын

    Very useful for me. Thanks I have macro based excel sheet but how to share for multiple user entry. Please suggest.

  • @tomgebka9943
    @tomgebka9943 Жыл бұрын

    Great video - the one piece that I am looking for is how to assign a path name for a file on Onedrive that I want to update, not a local workbook. Is there more to it than just the correct path name? When I look at the file path for the Onedrive it shows me a link. Thanks in advance

  • @murattulek5783
    @murattulek57832 жыл бұрын

    AB AN ERROR: thank you so much for your share and contribution us. i want to ask a question: normally this code run well but when i open another workbook i receive "RUN TIME ERROR NO 9", how can i fix this? (when i close the other workbook code starts well again) thanks a lot in advance!

  • @hirunimarasinghe5728
    @hirunimarasinghe57282 жыл бұрын

    Thank you for sharing. But I found an error in the line of masterNextRow- subscript error.

  • @shriharibhat6655
    @shriharibhat6655Ай бұрын

    Thank You for the informative video. I would just like to know how we can transfer range of values. I tried inserting the range in the inverted commas, but it is taking only value of the 1'st mentioned cell. If anyone could please help me with it would be great help. Thanks Anyways :)

  • @ryanallen8887
    @ryanallen8887 Жыл бұрын

    How can I run this same code, but with the feature of keeping the vbMaster open while using the input source? I would like to see the data entry happen side by side and not have the master file automatically close each time an input is "saved". Thanks!

  • @maheshkhursale8244
    @maheshkhursale82443 жыл бұрын

    Thanks. It's very useful. But can we have multiple copy of the input worksheet at clients side and data can be inputed at a time from multiple worksheets?

  • @TeachExcel

    @TeachExcel

    2 жыл бұрын

    Sure, you can have all sorts of setups like this! VBA allows you to do a lot - if you're interested in learning how to do a lot more than I showed in this tutorial, you can look at my new VBA Course: www.teachexcel.com/vba-course-update.php?src=yt_comment_reply

  • @TeachExcel
    @TeachExcel2 жыл бұрын

    VBA/Macros Course (40% Discount): www.teachexcel.com/vba-course-update.php?src=youtube_pinned_comment_hgyMrkVWw-o 200+ Video Tutorials - 200+ Downloadable Excel Reference Files - 50+ Hours of Content

  • @suzannejoshua9836
    @suzannejoshua98362 жыл бұрын

    Hi, may I know how I can save the data without opening the excel workbook using only the vba excel form.

  • @Couchsleep3r
    @Couchsleep3r Жыл бұрын

    I need to do this but copy a full table over what changes do I need

  • @vinothsathiyavan8328
    @vinothsathiyavan83282 жыл бұрын

    Hiii.. if my closed workbook stored in online how to mention the file path?

  • @thebetalearner9500
    @thebetalearner95002 жыл бұрын

    Is there a way to keep the values entered in the form instead of them disappearing when you hit save?

  • @PavalonTech

    @PavalonTech

    2 жыл бұрын

    Hmm at about 11 minutes in, he added two lines of code that is responsible for clearing those entries... you could leave those two lines out, and it won't disappear.

  • @travisbenge1912
    @travisbenge19122 жыл бұрын

    alright, what if I don't want to make duplicate entries but update an existing entry with additional/different information

  • @TeachExcel

    @TeachExcel

    2 жыл бұрын

    Hi Travis, that is totally possible and I cover pieces of this puzzle in many of the tutorials I've made here on KZread (you can search for them on my channel) and also in my full VBA course: www.teachexcel.com/vba-course-update.php?src=yt_comment_reply_hgyMrkVWw-o

  • @qamruddinmohammedi7665
    @qamruddinmohammedi76653 жыл бұрын

    Dear Sir, want to transfer data from one workbook to another workbook workbook -A 1. Receipt No. 2. Date 3. Name 4. Amount to Workbook - B in two different Sheets. can you please help me write correct VBA code.

  • @ramgshan
    @ramgshan10 ай бұрын

    I have application outside procedure error in each line

  • @allmight4732
    @allmight4732 Жыл бұрын

    I encountered error on masterNextRow it says subscript error

  • @offroadies6
    @offroadies63 жыл бұрын

    Sir what if I rename master workbook or chane location?

  • @TeachExcel

    @TeachExcel

    3 жыл бұрын

    Shouldn't matter if its the Master workbook with the code in it.

  • @curtismorris7482
    @curtismorris74822 жыл бұрын

    Why won’t my workbook file location work?

  • @moesadr3342
    @moesadr33423 жыл бұрын

    Is there a way that one can globally print all the codes ( Modules, Macros,....) in a an Excel file ( Workbook) to review, cross over,.... to be able to alter some without creating a catastrophe?

  • @safetyjrtmsafetygate1805
    @safetyjrtmsafetygate18052 жыл бұрын

    i'm using ur command in VBA but its so weird that whatever I entered it will overwrite the 1st entry and always become a new entry. able to resolve? Thanks

  • @TeachExcel

    @TeachExcel

    2 жыл бұрын

    Well it depends on a lot. I'd go over to our forum on www.teachexcel.com and upload the sample files you are working with and ask there - its much easier when the code and issue you are specifically mentioning is visible.

  • @gagayjhem
    @gagayjhem3 жыл бұрын

    How to save Data to another tab none vba pls

  • @TeachExcel

    @TeachExcel

    3 жыл бұрын

    Well, probably copy/paste is the simplest way or copy/paste special values (Ctrl + C > Alt + E + S + V Enter) Otherwise, I'm not sure exactly what you mean by saving the data - if you can upload a sample file, you should ask in my forum and it will be much easier to help you. www.teachexcel.com/talk/microsoft-office?src=yt_comment