Find next blank cell and paste copied values excel vba

somrakj

New Member
Joined
Jul 14, 2011
Messages
4
Hello,

I'm have a three sheet workbook and in one sheet I need to take values from A2:A1000 and B2:B1000, copy them and paste them into the first blank cell in Column A in a different sheet. This is a Macro that will be run each month on new sets of data. So that first blank cell is going to change every month.

I'm trying to get this to work as a bridge betweetn two macros and eliminate a manual step to make these 2 macros one macro.

I've tried various different codes but am not familiar enough with any of them to code them correctly.

Any help is greatly appreciated. On a side note, I have number format set to "000000000" to account for leading zero's that were dropped off. But the formula bar does not contain these zero's. Is there a way to make the value of the cells as they are displayed?

Thanks a million
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Try like this

Code:
Sub Cpy()
Dim LR As Long
With Sheets("Sheet1")
    LR = .Range("A" & Rows.Count).End(xlUp).Row
    .Range("A1:B" & LR).Copy Destination:=Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Offset(1)
End With
End Sub
 
Upvote 0
I'm not too sure what you want as it seems like you had 3 questions which 2 of them were related to one another.
So, I'll just answer 'making a bridge between 2 macros' problem.

you can just call two macros consecutively in this manner
Code:
Sub Bridge()
    Call Macro1
    Call Macro2
End Sub

This code will run macro named Macro1 first then Macro2.


As for your second question in formatting,
I think you could find a way to do it using CELL function and FORMAT function.
http://www.techonthenet.com/excel/formulas/cell.php
http://www.techonthenet.com/excel/formulas/format_string.php
 
Upvote 0
Thanks Vog! That worked brilliant the first time! Can't thank you enough!

Kpark,

Sorry, I was using "bridge" as a metaphor. The instructions vog provided were something that I had to do manually between the first macro I wrote, and the second macro I wrote. So by using that code, it allowed me to "bridge" them into one macro and eliminate that manual step. That was all part of question one that Vog answered lol, sorry for the confusion.

The second question was is it possible to get a cell that has a value of 12345678 but displays as 012345678, adopt that leading zero in the cell/value. And I should clarify that the value will be different for each cell that I need to adopt one or two leading zeros.
 
Upvote 0
Hi, I have got a question. You have given macro to work in the same worksheet. But I want code for to paste in separate work book or a new workbook
 
Upvote 0

Forum statistics

Threads
1,213,565
Messages
6,114,337
Members
448,568
Latest member
Honeymonster123

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