Easiest Ways to Copy and Paste Cells with Excel VBA (copy, pastespecial, resize & offset)

Join 400,000+ professionals in our courses here 👉 link.xelplus.com/yt-d-all-cou...
Discover the power of Excel's VBA with our tutorial on Copy and Paste Special methods. Perfect for those looking to automate and enhance their Excel tasks, this video covers essential techniques, including resizing ranges and excluding headers.
⬇️ Download the workbook here: pages.xelplus.com/vba-copy-re...
🔑 What You'll Learn:
▪️ Essential VBA Methods: Explore two vital methods in Excel VBA - Copy and Paste Special.
▪️ Variable Size Range Copying: Learn how to copy ranges of varying sizes, a handy skill for dynamic data sets.
▪️ Using Resize Property: Understand how to resize a range before copying, ideal for situations like excluding headers in a current region.
🎓 Get access to the full Excel VBA Course here 👉 www.xelplus.com/course/excel-...
This tutorial shows you how you can copy and paste with VBA. We use the copy method as well as the pastespecial method.
The copy method in VBA, copies data, as well as formatting, formulas, comments etc - with the pastespecial method, you have more control over your paste options. For example, you can paste formatting only - or choose to paste values as well as number formatting.
I also show you how to use the resize property, so you can change the size of the current region before you copy. This is good for cases where you want to copy the data but exclude the header. Here we add in OFFSET as well.
★★ Links to related videos: ★★
Referencing Ranges with VBA: • Excel VBA: Referring t...
Learn about Visual Basic Editor: • Excel VBA tutorial for...
Recording macros: • Excel VBA: Copy Data f...
Properties & methods in VBA: • Learn How to Use Prope...
★ My Online Excel Courses ★ ► www.xelplus.com/courses/
➡️ Join this channel to get access to perks: / @leilagharani
👕☕ Get the Official XelPlus MERCH: xelplus.creator-spring.com/
🎓 Not sure which of my Excel courses fits best for you? Take the quiz: www.xelplus.com/course-quiz/
🎥 RESOURCES I recommend: www.xelplus.com/resources/
🚩Let’s connect on social:
Instagram: / lgharani
LinkedIn: / xelplus
Note: This description contains affiliate links, which means at no additional cost to you, we will receive a small commission if you make a purchase using the links. This helps support the channel and allows us to continue to make videos like this. Thank you for your support!
#excel #vba

Пікірлер: 183

  • @LeilaGharani
    @LeilaGharani5 ай бұрын

    Grab the file I used in the video from here 👉 pages.xelplus.com/vba-copy-resize-file

  • @abrahamjeethu
    @abrahamjeethu2 жыл бұрын

    Let me be very frank with you Leila. I am an ardent viewer of many videos on VBA. if ever there is somebody who does the explanations in such a marvelous way, It's YOU...No other people. Man, you are just awesome. Hats off, God bless you.

  • @sakhilengwenya594

    @sakhilengwenya594

    Ай бұрын

    Me two. I love her work

  • @excelisfun
    @excelisfun6 жыл бұрын

    Thanks for the Copy Paste VBA Fun!!

  • @LeilaGharani

    @LeilaGharani

    6 жыл бұрын

    Thank you very much Mike :)

  • @hamphrey.olendo65
    @hamphrey.olendo65 Жыл бұрын

    love your tutorials so much, indeed you are an an expert

  • @ProgramadorExcelVBA
    @ProgramadorExcelVBA4 жыл бұрын

    Leila vba é outro nível, show de conteúdo.

  • @claudegiguere8731
    @claudegiguere87313 жыл бұрын

    Wow! Another great tutorial, thanks Leila!

  • @GosCee
    @GosCee10 ай бұрын

    Leila, has anyone told you lately how awesome you are? You are the best! It's the first time I've understood the resize range expression. Your explanation is so clear. Thank you very much.

  • @georgekiwi8178
    @georgekiwi81785 жыл бұрын

    Great Video Leila- really enjoying these videos! Great info :)

  • @yantowk8008
    @yantowk80085 жыл бұрын

    Very helpful and useful. Thank you.

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

    I find myself digging into your videos more often than before. And thank you for this tutorial, I was able to shorten the macro I recorded. 😀

  • @LeilaGharani

    @LeilaGharani

    Жыл бұрын

    Glad I could help!

  • @hamphrey.olendo65

    @hamphrey.olendo65

    Жыл бұрын

    @@LeilaGharani kindly is there excel formula to copy special values from one cell to another?, in such that when the initial cell is updated, the copied cell doesn't change

  • @hamphrey.olendo65

    @hamphrey.olendo65

    Жыл бұрын

    @@LeilaGharani hi leila, kindly is there excel formula to copy special values, without using vba?

  • @medasbabu
    @medasbabu3 жыл бұрын

    Hi Leila , you make it so simple, thanks for the short video, very keen to learn more VBA, thanks

  • @LeilaGharani

    @LeilaGharani

    3 жыл бұрын

    Happy to hear that!

  • @helenasvensson6595
    @helenasvensson65958 ай бұрын

    Magic! So well explained!

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

    . (Love your hands & nails, and this color is the best for them 💖💖💖💖) . Im glad I discovered your channel. Am a programmer (COBOL, Java, C++, you name it), but only now am I needed for Excel/VBA projects, so I'm watching all of your videos. .

  • @sandeepkothari5000
    @sandeepkothari50006 жыл бұрын

    LEILA, U R GR8!

  • @ceorgcl
    @ceorgcl5 жыл бұрын

    Helpful Thanks for the vedio Leila

  • @RondenBreems
    @RondenBreems2 жыл бұрын

    Crystal clear!

  • @virenk3813
    @virenk38134 жыл бұрын

    You made it so simple. That's great

  • @LeilaGharani

    @LeilaGharani

    4 жыл бұрын

    I'm glad to hear that :)

  • @SanthoshKumar-xy3zm
    @SanthoshKumar-xy3zm2 жыл бұрын

    Very well explained.Thank you so much mam🙏🙏🙏🙏🙏

  • @quasipseudo1
    @quasipseudo16 жыл бұрын

    Explained very good. Thanks!

  • @LeilaGharani

    @LeilaGharani

    6 жыл бұрын

    You're very welcome. Glad you like the explanation.

  • @ajexcel
    @ajexcel6 жыл бұрын

    Its looking so simple in this video than actually it would be..thanks a lot leila..will waiting for more on this..

  • @LeilaGharani

    @LeilaGharani

    6 жыл бұрын

    Thanks Ajay. It does get easier the more we practice :)

  • @ismailismaili0071
    @ismailismaili00716 жыл бұрын

    thank you so much Ms. Leila you are great appreciated

  • @LeilaGharani

    @LeilaGharani

    6 жыл бұрын

    You're very welcome Ismail.

  • @chaitanyatuckley4666
    @chaitanyatuckley46663 жыл бұрын

    Thanks a lot Madam, Keep up the good work.

  • @afriyatno5557
    @afriyatno55573 жыл бұрын

    thank you, its very helpfull for me

  • @johnborg6005
    @johnborg60056 жыл бұрын

    Thanks leila. This was very interesting :)

  • @LeilaGharani

    @LeilaGharani

    6 жыл бұрын

    You're welcome John :)

  • @DuyenLe-kt3xx
    @DuyenLe-kt3xxАй бұрын

    a very instructive tutorial, thanks

  • @LeilaGharani

    @LeilaGharani

    Ай бұрын

    You are most welcome!

  • @sahilkadu5409
    @sahilkadu54095 жыл бұрын

    Leila u teach so well😭 im ur big fan

  • @LeilaGharani

    @LeilaGharani

    5 жыл бұрын

    I'm glad to hear that.

  • @mohitdhanwani5540
    @mohitdhanwani55406 жыл бұрын

    Thanks for the video ma'am....nicely explained...loved it! 😊

  • @LeilaGharani

    @LeilaGharani

    6 жыл бұрын

    You're welcome Mohit :)

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

    Thank you very much.

  • @kishangzp
    @kishangzp4 жыл бұрын

    Great Video... thumps up!

  • @sivaramakrishnayarlagadda7007
    @sivaramakrishnayarlagadda70076 жыл бұрын

    Thanks for received in your valuable tricks .

  • @LeilaGharani

    @LeilaGharani

    6 жыл бұрын

    You're welcome Sivarama.

  • @MohammadAshooryan
    @MohammadAshooryan6 жыл бұрын

    hi leila(excelwoman),as usual, your simple method learning is very usefull. thanks for sharing your excel knowlege.looking forward your next lectue.

  • @LeilaGharani

    @LeilaGharani

    6 жыл бұрын

    Thank you Mohammad. I'm happy you like the teaching style. Next VBA video will be up next week :)

  • @kctechie
    @kctechie8 ай бұрын

    THANK YOU!!!

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

    Thanks for helping me with work 👍

  • @LeilaGharani

    @LeilaGharani

    3 ай бұрын

    🙏

  • @abdallah.kandiel
    @abdallah.kandiel6 жыл бұрын

    One more thing U concentrate on the points thar matters And usefull to daily tasks Thanks for making excel peace of cake Thanks leila

  • @LeilaGharani

    @LeilaGharani

    6 жыл бұрын

    Thank you! Really appreciate your support of all the videos.

  • @mohamedabouelfetouh6265
    @mohamedabouelfetouh62654 жыл бұрын

    Hello Leila thanks a lot for the video, i wonder if you can do copy from multiple worksheets and pastespecial values to a single worksheet

  • @anthonyflorianterrapon6575
    @anthonyflorianterrapon65753 жыл бұрын

    Hi Leila ! Your video is great. I need your help on how to copy paste data into a table format. I need to add it at the end of the table and with your method it always return an error...

  • @ANGELiki1992
    @ANGELiki19922 жыл бұрын

    Thanks!!!!!!!!!!!!!!!

  • @sarasamin
    @sarasamin4 жыл бұрын

    I always learn a lot from your videos..Thank you so much.I have a question about currentregion,is there a way to copy paste just a few rows or columns that acts like currentregion "to be dynamic" you're the best

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

    Thank you :)

  • @LeilaGharani

    @LeilaGharani

    Жыл бұрын

    That's very kind, thank you!

  • @sumitjain3017
    @sumitjain30174 жыл бұрын

    What if we want to copy paste with cell dimensions (Row Height, Col Width, Merge, Picture etc) as we do mannually using fomat painter on clip board

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

    Thanks

  • @LeilaGharani

    @LeilaGharani

    Ай бұрын

    Thank you!

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

    Thanks!

  • @LeilaGharani

    @LeilaGharani

    Жыл бұрын

    Thank you so much!

  • @anandchaudhari8528
    @anandchaudhari85286 жыл бұрын

    best of the best..........

  • @LeilaGharani

    @LeilaGharani

    6 жыл бұрын

    Thank you! Glad you like it :)

  • @debjitsarkar2651
    @debjitsarkar26514 жыл бұрын

    awesome

  • @stevennye5075
    @stevennye50754 жыл бұрын

    well done

  • @CP-yl5bl
    @CP-yl5bl4 жыл бұрын

    Leila...great tutorial.I have a question.On sheet1 I have a table W8:AA450.I want to bring data from this table to sheet2 in a fixed range A4:A8,one row at a time.Because for each row of data from sheet1 table ,I'm doing some calculation on sheet2.Can you make a video or reply here thx.

  • @HowtoHacks
    @HowtoHacks3 жыл бұрын

    What if you have formulas in the range and are using iferror to make them blank? I'm trying to only copy the cells with text from the formulas and this method works but it's copying all the cells with formulas in them.

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

    Hi Leila is there a non-vba solution were you can convert formulas to values in cells which are associated with dates past a certain date?

  • @khalidalisubhanallah2947
    @khalidalisubhanallah29476 жыл бұрын

    Thanks mam Nice Video

  • @LeilaGharani

    @LeilaGharani

    6 жыл бұрын

    You're very welcome Khalid.

  • @hosseinhosseinpoor4845
    @hosseinhosseinpoor48453 жыл бұрын

    thanks thanks thanks

  • @Melki
    @Melki15 күн бұрын

    Terima kasih.

  • @LeilaGharani

    @LeilaGharani

    10 күн бұрын

    Thank you! Glad our content is helpful!

  • @bassisessaidexcel
    @bassisessaidexcel2 жыл бұрын

    Merci

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

    Thank you very much! Could you please give the code for copy-paste a table that to a specific cell on another sheet (i.e.: Print? NB: That latter sheet has information such as Name and signature, and date of order. This sheet has to be printed

  • @GalinaT100
    @GalinaT1002 жыл бұрын

    How to auto squeeze weekends column up to 0.8 width for all year? The date is 11/05/2021 on the top the column. I need squeeze like ## size for them.

  • @55MLF
    @55MLF4 жыл бұрын

    When I copy with paste special, it deletes my conditional formatting (color coding). Am I doing something wrong?

  • @yogendrayogesh3307
    @yogendrayogesh33073 жыл бұрын

    Any way to actually find all cells in a sheet with same value and repliacte the cell formatting across all whenever its changed on any of those cells.

  • @sandeepkothari5000
    @sandeepkothari50006 жыл бұрын

    Leila, I enrolled myself for your VBA course today. Meet you there.

  • @LeilaGharani

    @LeilaGharani

    6 жыл бұрын

    I hope you find a lot of value in the course for your work! Thank you for your support.

  • @sandeepkothari5000

    @sandeepkothari5000

    6 жыл бұрын

    Welcome.

  • @udaymohannamburi5039
    @udaymohannamburi50393 жыл бұрын

    Hie Leila The video was awesome In the same way can we copy (fixed range) to paste special (in dynamic) only after giving command.

  • @Disaenz10
    @Disaenz106 жыл бұрын

    Hi Leila thank you for your videos. Do you have or have any plans on how to migrate data from one excel workbook that is in one carpet to another workbook in another carpet ? Let's say that I have monthly reports and I want to consolidate them all in just one sheet. Thanks !

  • @LeilaGharani

    @LeilaGharani

    6 жыл бұрын

    Yes - I cover these in my VBA course. I will try and add one of the videos to KZread as well in the next weeks...

  • @Disaenz10

    @Disaenz10

    6 жыл бұрын

    Leila Gharani awesomeee, please let me know when you upload it. Thanks!

  • @parimalaarya2041
    @parimalaarya20415 жыл бұрын

    Hi I have a list of names in a column I need to apply filter for each names and copy the related data of names ,how to do that in VBA code pls share the code

  • @pprahul2003
    @pprahul200311 ай бұрын

    What if the data has broken rows i.e if the data is spread in different rows and few rows are blank in between. Will current range work?

  • @seemoon6338
    @seemoon63384 жыл бұрын

    hi can you tell me how can we to print userform fit to paper ..pleas

  • @mdzen22e
    @mdzen22e5 жыл бұрын

    can you show how to loop the selection

  • @ShikhaSharma-qw4px
    @ShikhaSharma-qw4px5 жыл бұрын

    I want to copy data from multiple sheets in a workbook and paste it to one sheet in other workbook. It would be great if anyone can help

  • @edgarestuardorodriguezflor9017
    @edgarestuardorodriguezflor90173 жыл бұрын

    Hi, how do I resize a chart width using offset and counta with vba? Pleas help me

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

    So how do you copy a range from one workbook to another using Control C to copy the range, then go to the sheet you want to paste into and click a paste button that does a PasteSpecial on the values? it seems I can make this work with an unlocked file, but when I lock it down, it will not let me paste through the macro button.

  • @theenlightened1s
    @theenlightened1s5 жыл бұрын

    Please share how we can copy only the rows that fulfil a certain criteria.. thanks

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

    Hi Ms. Leila. I would just like to ask if it's possible to copy paste data on a spreadsheet even if the file is in a view mode only? My teammates and I are having a hard time working using this file because we have to manually look at the items, copy and paste it on a separate sheet so we cannnot vlookup the items. We manually click ctrl + f then ctl + c & p instead. Your helo would be very valuable to us. Thank you!

  • @PraveenKumar-hv9is
    @PraveenKumar-hv9is6 жыл бұрын

    Your way of teaching is amazing madam thanks for given such good VBA videos class and teaching.

  • @LeilaGharani

    @LeilaGharani

    6 жыл бұрын

    You're very welcome Praveen. I'm happy you like the videos and the teaching :)

  • @AmitSharma-po1zb
    @AmitSharma-po1zb5 жыл бұрын

    Hi Leila, need a small help, actually i need to copy data from one worksheet to another only when the headers of both worksheets match. i have written a code which is actually copying the entire range from one worksheet to another but actually the situation is, once the headers match, the data gets copied and then next time the data should get copied skipping one row in destination worksheet. please help

  • @magorzatagaik2440
    @magorzatagaik24406 жыл бұрын

    Very interesting lesson. I would like to ask you if you can prepare tutorial - how to use excel formulas in VBA?

  • @LeilaGharani

    @LeilaGharani

    6 жыл бұрын

    Glad you like it. Ok - will add this to my list. Thank you for your suggestion.

  • @mahendhiranp4856
    @mahendhiranp48562 жыл бұрын

    Hi, If I run VBA of Paste special method. The pasted column Turns into a text. Could you Please help me to covert the pasted column into number format in VBA itself?

  • @accnotech3863
    @accnotech38636 жыл бұрын

    its a great tutorial, but what if, i want to copy and paste my data to a template that doesn't allow copy paste, well in such a case we have to link name ranges, or cell references, isnt it? or is there any good way then this

  • @LeilaGharani

    @LeilaGharani

    6 жыл бұрын

    If the sheet is protected, you can un-protect in the macro before pasting and then re-protect. If you are using named ranges, you can reference that directly in the macro. This video shows different ways of writing to ranges: kzread.info/dash/bejne/k5d7rMRyf9LQmNI.html

  • @pawankoli2009
    @pawankoli20092 жыл бұрын

    Hi Leila, Need you help, it is possible to export entire excel file with same data and formats but not formulas. i have a file has charts, pivots, report dashboard with sources data but i dont want to share this file with formulas.

  • @issamalkhesho6775
    @issamalkhesho67753 жыл бұрын

    Hello Leila, I am wondering if you can help me with the following task: I have two work books, the first one is to create invoice with customer information and purchasing details , the second workbook is to save dynamically the data including the invoice number , date, total price ..etc. extracted form the first workbook . At the end of the day I am going to save both workbooks and shut down the computer . what I would like to have the next day is when I open the first workbook , I want to open the second workbook using a command button on the first workbook , also I want to be able to get the last invoice number saved in the second workbook to be transferred to the first workbook with adding one to it . the invoice numbers are saved in column A2 :A in the second workbook. the invoice cell number is L11 in the first workbook . I have created a command button on the first workbook to open the second workbook , that is successful , but I am not able to write the correct VBA code to transfer the last row cell value of column A from second workbook to the first workbook . Can you please help me ? thanks Issam

  • @mkdon3988
    @mkdon39882 жыл бұрын

    Hi leila, Is there a way to copy and paste missing information from 1 column to another by match.?? Example: colm1 column 2 123 a 342 342 c 123 Automatically copy missing carctrs a & c wher they belong.

  • @farzanmoha8935
    @farzanmoha89355 жыл бұрын

    Hi Leila, can you please tell me how can I paste in only UN HIDE cells in excel (the visible ones)? Alt; only works for copy the visible cells not for paste in visible ones. Thank you!

  • @farzanmoha8935

    @farzanmoha8935

    5 жыл бұрын

    Does anyone know the answer?

  • @sandipmakwana6462
    @sandipmakwana64624 жыл бұрын

    👌

  • @samuelgirma8532
    @samuelgirma85323 жыл бұрын

    If you have please recommend the video, about Excel Vba paste special value if looking or finding Todays value . 💚💛❤️

  • @brigadeshivu
    @brigadeshivu4 жыл бұрын

    How to auto repeat paste special at each interval of time

  • @lilitvardanyan4366
    @lilitvardanyan43666 жыл бұрын

    👍👍👍

  • @SPARK9026ONLINE
    @SPARK9026ONLINE3 жыл бұрын

    I need your help about VBA, will you do please, when you free time ?

  • @elasmarsaadallah6126
    @elasmarsaadallah61263 жыл бұрын

    how can i use a formula to a table without loop in vba , for example i want to replace a array 1 ,5 , 6, 8 by the same array + 4 : 5, 9, 10, 12

  • @barbarasakowicz5338
    @barbarasakowicz53384 жыл бұрын

    Hey, In your Video you didn't manage how can I Past all Tablle + Color about the table but as a Value. SO I want to keep the color and point as a Value

  • @pravin.kakade
    @pravin.kakade Жыл бұрын

    Hi Ma'am, I have a question. How can we copy paste a data which has data+images.?? If we are working in one Excel and there is data+ images ( just like BOQ or quotation) so how can we copy or paste the some data ? Because sometimes what happens that the images do not copy well in format. So need solution please.

  • @benaragon12
    @benaragon124 жыл бұрын

    How do I copy a cell into another cell if its blank using VBA macro?

  • @InsideMyWall
    @InsideMyWall2 жыл бұрын

    How to browse a folder or files via Excel VBA, copy the name and paste it in a specified 'word' file??

  • @johnsonbolhayon4790
    @johnsonbolhayon47905 жыл бұрын

    How can this be applied from a different sheet? What needs to be modified? I'd like to cut the datasource and paste it to a different sheet.

  • @LeilaGharani

    @LeilaGharani

    5 жыл бұрын

    The worksheet name needs to be added before the range reference. This is something we cover in detail inside the course - I'll add it to my list to put out some videos on this topic for KZread.

  • @mananaeem
    @mananaeem4 жыл бұрын

    I need code to collect data from different workbooks books in folder and copy each relevant sheet in master file. I have three different file in folder and have 3 works sheets in each file. I need to loop through each file and copy relevant sheet to relevant master file. Than data from next file to master workbook. Waiting for reply, please Naeem

  • @mohammadalmomani1193
    @mohammadalmomani11935 жыл бұрын

    Hello I am trying to find an vba code to copy and paste every range of rows like(A1:C19).copy and paste in word file as image then copy from (A20:C39) and paste in the same word file and so on for the rest of the table in excel. they have told me that I need to use the looping in excel but I don't know exactly how to do it …. please help if you can

  • @sivaramakrishnayarlagadda7007
    @sivaramakrishnayarlagadda70076 жыл бұрын

    how to copy apply after auto filter only particular rows. ex. apply autofilter only first 4 rows copy. Please give me answer.

  • @LeilaGharani

    @LeilaGharani

    6 жыл бұрын

    To copy only visible rows in the autofilter, you can use this code: ActiveSheet.AutoFilter.Range.Copy

  • @siddh8508
    @siddh85082 жыл бұрын

    how to copy bulk records with copy and paste specials with macros, its only copying 900 records maximums

  • @abdullahquhtani8058
    @abdullahquhtani80586 жыл бұрын

    One very important questions raises here!! Is it possible to copy different ranges from different sheets and paste them in a specific range?!

  • @LeilaGharani

    @LeilaGharani

    6 жыл бұрын

    Hi Abdullah - yes - you just have to put the sheet name before the range - you can do this for example by Worksheets("Source").range("A4").currentregion.copy and paste it in another sheet, by mentioning the sheet name before the range. You can also use the code name of the sheet instead of referring to it through the sheets collection.

  • @abdullahquhtani8058

    @abdullahquhtani8058

    6 жыл бұрын

    Leila Gharani I tried that before but I had to copy and paste two or three times. My question was: Is it possible to copy two different ranges from two sheets and paste those two ranges in a specific range in code. I hope I made it clear. Thank you so much for your cooperation.

  • @LeilaGharani

    @LeilaGharani

    6 жыл бұрын

    I see - If all your areas are one sheet, you could do it in one line like this: Range("A4:B7,A28:B32,A40:B42").Copy and then paste in one cell. But if your areas are in different sheets, you could use variables for the different areas and then do a loop to copy paste them in the loop. You'll need a variable for the next available row as well.

  • @pouoiza7163
    @pouoiza71633 жыл бұрын

    dear sir I woukd like to learning about excel vba sumif function . please sir.

  • @Dopeboyz789
    @Dopeboyz7895 жыл бұрын

    What about a copy and paste button

  • @jerry5149
    @jerry51492 ай бұрын

    For the first time, I was confused by your lesson?

  • @moneebshaikh
    @moneebshaikh3 жыл бұрын

    How to copy paste data with specific header name

  • @dasrotrad
    @dasrotrad6 жыл бұрын

    When I run ?Range("A4").CurrentRegion.Offset(1,0) in the immediate window, I get Run-time error 13: type mismatch. The line of code, "Range("A4").CurrentRegion.Offset(1,0)" is showing RED in the VBE. I also tried running "Application.Workbooks ("Book1").Worksheets("Sheet2").Select" in Workbook "Book1" and I got a runtime error: Run-time error 9: Subscript out of range. Could this be a related issue? Any idea what is going on? Thank you. Robert

  • @LeilaGharani

    @LeilaGharani

    6 жыл бұрын

    Hi Robert, you need .address in the end.

  • @dasrotrad

    @dasrotrad

    6 жыл бұрын

    Leila Gharani THANK YOU!

  • @LeilaGharani

    @LeilaGharani

    6 жыл бұрын

    You're welcome.

  • @sandeepkothari5000
    @sandeepkothari50006 жыл бұрын

    how can I download the workbook for my practice?

  • @LeilaGharani

    @LeilaGharani

    6 жыл бұрын

    I see - the link is missing - I'll update it in a bit...will let you know.

  • @sandeepkothari5000

    @sandeepkothari5000

    6 жыл бұрын

    Thanks.

  • @LeilaGharani

    @LeilaGharani

    6 жыл бұрын

    The workbook is now available here: www.xelplus.com/vba-copy-paste/ - just scroll down to the bottom of the post.

  • @sandeepkothari5000

    @sandeepkothari5000

    6 жыл бұрын

    Thanks a ton Leila.

  • @sandeepkothari5000
    @sandeepkothari50006 жыл бұрын

    1. In VBA code, what are arguments to Copy-Paste following: a. “Äll merging conditional formats” option showing in paste special dialogue box; b. paste link; c. Row heights; d. fixed picture & e. linked picture; f. use of camera to copy & paste pictures, images.

  • @LeilaGharani

    @LeilaGharani

    6 жыл бұрын

    Hi Sandeep - here it's best to use the macro recorder and test each one. This gives you a quick glossary of all the options available - you can copy and paste the code and adjust for your projects.