Selecting Data and copying Macro

najj1

New Member
Joined
Nov 29, 2013
Messages
1
Hi,
I've made a code to copy data from a loader table and move it to the data, but it keeps on coming up with the same error. Was wondering if anybody could fix the error because I have tried but can't see, to fix it. The bug occurs at the text in red. But if there are any other bugs would be good to have those fixed too.

Thanks

The code is:

Dim DataRow, LoadColumns, LoadRows, UpdateRow, ReplaceRow, StartRow, EndRow, VisRow As Integer
Sub LoadUpdate()
'
' LoadUpdate Macro


' Pastes new data from Loader into DataTable at bottom of table
Application.ScreenUpdating = False


' Get row number in DataTable where table starts
Application.Goto Reference:="StartData"
StartRow = ActiveCell.Row

' Get row number in DataTable where new data will be pasted
Application.Goto Reference:="LastRow"
EndRow = ActiveCell.Value
DataRow = EndRow - StartRow + 1


' Get size of datablock for newly entered data in Loader
Application.Goto Reference:="NewRows"
LoadRows = ActiveCell.Value - 1
Application.Goto Reference:="NewColumn"
LoadColumns = ActiveCell.Value - 1


' Add extra rows to DataTable so that Named Ranges are auto updated
AddRows

' Select new data in Loader and copy
Application.Goto Reference:="StartLoad"
Range(ActiveCell, ActiveCell.Offset(LoadRows, LoadColumns)).Select
Selection.Copy

' Paste new data to DataTable
DataLoad

'****ClearNew macro disabled so that the Loader table can be seperately reset****
' ClearNew
Application.Goto Reference:="StartData"
' Flag that data has been transferred to DataTable
Sheets("ReptSelect").Visible = True
Application.Goto Reference:="LoadDone"
Selection.Copy
Application.Goto Reference:="LoadCheck"
Selection.PasteSpecial Paste:=xlPasteFormulas, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.Goto Reference:="LoadDone"
ActiveWindow.SelectedSheets.Visible = False

Application.Goto Reference:="StartLoad"
Application.CutCopyMode = False

End Sub


Sub AddRows()


' Macro subroutine used by LoadUpdate macro
'


' Extends the DataTable by adding the number of new rows to be pasted from Loader
' Required to ensure named ranges are extended beyond the new data


Application.Goto Reference:="StartData"
ActiveCell.Offset(DataRow + 2, 0).Select
Range(ActiveCell, ActiveCell.Offset(LoadRows, 300)).Select
' *** Note - extends rows out to column 300 (ie Column KN),
' if more columns are added need to change in preceding row in macro***
Selection.Insert Shift:=xlDown

End Sub


Sub DataLoad()


' Macro subroutine used by LoadUpdate macro
'


' Position in cell and paste new data into Prod_Data table
Application.Goto Reference:="StartData"
ActiveCell.Offset(DataRow, 0).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False

' Application.Goto Reference:="StartData"
End Sub


Sub AddCalcs()
'
' Macro subroutine used by LoadUpdate macro
'


' Update the formulae that are to the right of added data in the DataTable
Application.Goto Reference:="DataFormulae"
Selection.Copy

ActiveCell.Offset(DataRow - 1, 0).Select
Range(ActiveCell, ActiveCell.Offset(LoadRows, 0)).Select

ActiveSheet.Paste

End Sub


Sub ClearNew()

' Reset the Loader input table to blank form for new data entry
' Requires a blank but preformatted copy of the input table stored below the used sheet


Application.Goto Reference:="NewSet"
Selection.Copy
Application.Goto Reference:="StartLoad"
' ActiveCell.Offset(1, 0).Select
ActiveSheet.Paste

' Flag that data has not been transferred to DataTable
Sheets("ReptSelect").Visible = True
Application.Goto Reference:="LoadToDo"
Selection.Copy
Application.Goto Reference:="LoadCheck"
Selection.PasteSpecial Paste:=xlPasteFormulas, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.Goto Reference:="LoadDone"
ActiveWindow.SelectedSheets.Visible = False

Application.CutCopyMode = False
Application.Goto Reference:="StartLoad"
ActiveWindow.SmallScroll Down:=-1
End Sub
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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