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
Exactly what I was looking for... Thank You!!!!
Really Nice Simple Bit Of VBA Code Thumbs Up...Thank You Sir :)
Thanks a lot for this!!!
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
2 жыл бұрын
Very nice!!! :)
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!!
Thank you so mutch
thank you, with little adjustment i'm able to finish my work
Very useful for me. Thanks I have macro based excel sheet but how to share for multiple user entry. Please suggest.
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
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!
Thank you for sharing. But I found an error in the line of masterNextRow- subscript error.
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 :)
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!
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
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
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
Hi, may I know how I can save the data without opening the excel workbook using only the vba excel form.
I need to do this but copy a full table over what changes do I need
Hiii.. if my closed workbook stored in online how to mention the file path?
Is there a way to keep the values entered in the form instead of them disappearing when you hit save?
@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.
alright, what if I don't want to make duplicate entries but update an existing entry with additional/different information
@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
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.
I have application outside procedure error in each line
I encountered error on masterNextRow it says subscript error
Sir what if I rename master workbook or chane location?
@TeachExcel
3 жыл бұрын
Shouldn't matter if its the Master workbook with the code in it.
Why won’t my workbook file location work?
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?
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
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.
How to save Data to another tab none vba pls
@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