Macro Row Modification

Papi

Well-known Member
Joined
May 22, 2007
Messages
1,592
The following macro is used to open a file and select from the top to the bottom and basically copy the data over to the current workbook, then close the workbook that it opened. The problem is that the macro uses Column A of the workbook that is opened and I am finding that sometimes there are a few cells empty which can stop all data below that from copying over the necessary data. Is there a way to find the bottom without running into such spaces?

Sub Acquire_Data()
'
' Aquire_Data Macro
'
'
Application.ScreenUpdating = False
Sheets("SAW").Select
Application.Run "'Builder Analysis Review (BAR).xlsm'!Show_ALL"
Workbooks.Open Filename:= _
"X:\SERVICE & WARRANTY\SAW Case Files\0 Service and Warranty Master Database.xls"
x = ActiveWorkbook.Name
Application.Goto Reference:="R1C1"
Application.Run "'0 Service and Warranty Master Database.xls'!Show_ALL"
ActiveCell.Offset(1, 0).Rows("1:1").EntireRow.Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Windows("Builder Analysis Review (BAR).xlsm").Activate
Application.Goto Reference:="R2C1"
ActiveSheet.Paste
Application.CutCopyMode = False
ActiveCell.Select
ActiveWindow.ActivateNext
Workbooks(x).Close False
Application.ScreenUpdating = True
ActiveCell.Select
End Sub
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
You can use Cells(Rows.Count,"A").End(xlUp) to get the last used row, as the Up method won't hiccup on data gaps.

You could also use Cells.Copy if you want to copy the entire sheet.

HTH,
 
Upvote 0
Hello Smitty,

Thanks for your help. I'll look at that when I get home. That may work better doing the entire worksheet. Many thanks.
 
Upvote 0

Forum statistics

Threads
1,224,527
Messages
6,179,334
Members
452,907
Latest member
Roland Deschain

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