LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Macro-Run-time error '6'

I have an Excel wookbook that has three tabs. Two of the
tabs are for doing manual input such as adding and
deleting rows, or adding/deleting data. The third tab
(called Print) is meant to be read only where no manual
input is to be done. I have a macro that is run from a
button on the Print tab that combines all the manual input
from the other two tabs and formats it all nicely on the
Print tab for the purpose of updating the data and
printing it out. This macro works great. The problem I
have is that the macro formuls are located on the Print
tab and occasionally people who work in this workbook
forget not to do anything on the Print tab and they
sometimes add or delete rows and throw off the formulas.
So I created another tab called lookups and cut & pasted
the macro formulas to that tab with the intent of hiding
the lookups worksheet and eliminate the user errors. My
problem is that after I moved the formulas from the Print
worksheet to the lookups worksheet I am receiving a Run-
time error '6': Overflow when I run the macro. I have
included the code from the VB editor and I put *** before
the line of code that is highlighted when I run the
Debugger. I know this is a long post and I appreciate the
patience in reading it. Any help in resolving this macro
issue will be greatly appreciated.

Thanks, Dave (code below)

Dim cellloc As Integer
Dim cellloc2 As Integer
Application.Goto Reference:="clear"
Selection.RemoveSubtotal
Range("clear").Select
Selection.ClearContents
Application.Goto Reference:="formats"
Selection.Copy
Range("clear").Select
Selection.PasteSpecial Paste:=xlPasteFormats,
Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("LTOB").Select
Range("A2:B2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets("Print").Select
Range("A2").Select
Selection.PasteSpecial Paste:=xlPasteValues,
Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Selection.End(xlDown).Select
cellloc = ActiveCell.Row
Range("A" & cellloc + 1).Select
Sheets("LtrOC").Select
Range("A1").Select
Range("A2:B2").Activate
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets("Print").Select
ActiveSheet.Paste
Application.Goto Reference:="lookups"
Selection.Copy
Range("A2").Select
Selection.End(xlDown).Select
*** cellloc2 = ActiveCell.Row
Range("C2:C" & cellloc2).Select
ActiveSheet.Paste
Range("C2").Select
Range("A1:R" & cellloc2).Sort Key1:=Range("A2"),
Order1:=xlAscending, Key2:=Range _
("B2"), Order2:=xlAscending, Header:=xlGuess,
OrderCustom:=1, MatchCase _
:=False, Orientation:=xlTopToBottom,
DataOption1:=xlSortNormal, _
DataOption2:=xlSortNormal
Selection.Subtotal GroupBy:=1, Function:=xlSum,
TotalList:=Array(7, 8, 9, 10 _
), Replace:=True, PageBreaks:=False,
SummaryBelowData:=True
End Sub

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
I tried to get around the problem of the pivot table field settingdefaulting to Count instead of Sum by running a macro of change the settingfrom Count to Sum. However, when I tried to run the Macro, I got error messageof run time error 1004, unable Enda80 Excel Worksheet Functions 1 May 3rd 08 02:35 PM
I tried to get around the problem of the pivot table field settingdefaulting to Count instead of Sum by running a macro of change the settingfrom Count to Sum. However, when I tried to run the Macro, I got error messageof run time error 1004, unable Enda80 Excel Discussion (Misc queries) 1 May 3rd 08 10:52 AM
Ignore macro run time error phil Excel Discussion (Misc queries) 4 March 27th 08 12:11 PM
Macro Run-time error shirley_kee Excel Discussion (Misc queries) 1 May 3rd 06 09:50 PM
Macro time out error mike b Excel Worksheet Functions 1 December 10th 05 05:21 PM


All times are GMT +1. The time now is 01:05 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"