Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ERROR in MACRO

Status
Not open for further replies.

naikadit

Technical User
Jun 30, 2008
22
US
Hi

I am running a VBA macro and I am getting the error "RUN TIME ERROr 6 OVERFLOW". Attached is the file. Please need help ASAP the subroutine I am running is update sheets();

I have the file let me know how I can send it
 




Hi,

"I have the file let me know how I can send it "

This is not the way we do things here at Tek-Tips. If you want help like your request, go out and hire a consultant!

Members here provide free advice and tips, based on questions and examples posted by other members like yourself in threads.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Skip is right, of course, but that doesn't mean we won't help. Try posting the part of your code that's failing (your debug should tell you), or all of it if it's not too big. Also tell us what you're trying to accomplish.

_________________
Bob Rashkin
 
naikadit, we will try to help/suggest as best as we can. However, it would be a good idea to read the FAQ on getting good answers.

We are not a Help Desk. We are not paid to help anyone. We like to help people, and the people we like to help the most are the people who try to help themselves.

The best way to do that is:

be very clear and explicit

For example, "I am running a VBA macro" is not explicit at all. We have no idea what application you are trying to run the VBA code from. We have no idea if this VBA code is running from one application, but executing actions in another. This kind of information can be crucial.

Most of the time no one here is going to take someone's file and fix it for them. As Skip points out, that is the job of a consultant. Consultants get paid. Consultants do respond (sometimes) to "Please need help ASAP".

I can see you are new here, so welcome to the forum. The more you put into it, the more you will get out of it.

Post some code that we can look at. Make sure you mark the line where the error originates. Use the highlighting tools, or font colors. if you do not know how to do that, please click the "Process TGML" link - it is one of the Step 2 Options[/color red] on the reply screen.

faq219-2884

Gerry
My paintings and sculpture
 
naikadit,

This is the first time I respond in this forum. Hopefully I apply to the standards of Tek-tips.

The overflow error is mainly caused due to a wrong variable assignment.

Try using the variant data type which uses more memory but can handle all data types.

Sub TestDataType()

Dim number As Byte ' Change byte for Double or Variant
On Error GoTo WhichError
number = 300 '

Exit Sub
WhichError:
MsgBox Err.Description ' Overflow error

End Sub
 
Typically this happens when you work with whole numbers and exceed limit for integers. Without forcing VBA to treat one of numbers as long (&) or double (#) or using longer than integer variable, the result will be assumed as integer:
Code:
' correct
j = 200& * 200
MsgBox j
' overflow
i = 200 * 200
MsgBox i

combo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top