Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 117
Default overflow error 6.. the macro just stops any idea why?

Hi, the code below adds 1 thru' 14 in column 8 as long as there is
a value in column 1, but it stops running at row 32767 with an overflow
error l need it to carry on down to past row 60,000 is my machine not
good enough? (I did not write the code)

thanks for any help

ste

Sub add1to14()
Application.ScreenUpdating = False
Dim mrow As Integer, mvalue As Integer
Range("a2").Select 'start at cell A1
mvalue = 1
Do Until ActiveCell.Value = ""
mrow = ActiveCell.Row
Cells(mrow, 8) = mvalue
mvalue = mvalue + 1
If mvalue 14 Then mvalue = 1

ActiveCell.Offset(1, 0).Range("A1").Select
Loop
Range("A1").Select
Application.ScreenUpdating = True
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 618
Default overflow error 6.. the macro just stops any idea why?

Hi

a variable with a data type of "integer" will store numbers up to 32767
change
dim mrow as integer
to
dim mrow as long

and you might like to do the same for mvalue

Cheers
JulieD

"ste mac" wrote in message
om...
Hi, the code below adds 1 thru' 14 in column 8 as long as there is
a value in column 1, but it stops running at row 32767 with an overflow
error l need it to carry on down to past row 60,000 is my machine not
good enough? (I did not write the code)

thanks for any help

ste

Sub add1to14()
Application.ScreenUpdating = False
Dim mrow As Integer, mvalue As Integer
Range("a2").Select 'start at cell A1
mvalue = 1
Do Until ActiveCell.Value = ""
mrow = ActiveCell.Row
Cells(mrow, 8) = mvalue
mvalue = mvalue + 1
If mvalue 14 Then mvalue = 1

ActiveCell.Offset(1, 0).Range("A1").Select
Loop
Range("A1").Select
Application.ScreenUpdating = True
End Sub



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default overflow error 6.. the macro just stops any idea why?

Integers are signed numeric variables that can store numbers
between +/-32K. Use a Long instead of an Integer.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"ste mac" wrote in message
om...
Hi, the code below adds 1 thru' 14 in column 8 as long as there
is
a value in column 1, but it stops running at row 32767 with an
overflow
error l need it to carry on down to past row 60,000 is my
machine not
good enough? (I did not write the code)

thanks for any help

ste

Sub add1to14()
Application.ScreenUpdating = False
Dim mrow As Integer, mvalue As Integer
Range("a2").Select 'start at cell A1
mvalue = 1
Do Until ActiveCell.Value = ""
mrow = ActiveCell.Row
Cells(mrow, 8) = mvalue
mvalue = mvalue + 1
If mvalue 14 Then mvalue = 1

ActiveCell.Offset(1, 0).Range("A1").Select
Loop
Range("A1").Select
Application.ScreenUpdating = True
End Sub



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 117
Default overflow error 6.. the macro just stops any idea why?

Integers are signed numeric variables that can store numbers
between +/-32K. Use a Long instead of an Integer.


Many thanks to Julie and Chip, back up and running again

cheers to both

ste
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 618
Default overflow error 6.. the macro just stops any idea why?

you're welcome

"ste mac" wrote in message
m...
Integers are signed numeric variables that can store numbers
between +/-32K. Use a Long instead of an Integer.


Many thanks to Julie and Chip, back up and running again

cheers to both

ste





Reply
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
Overflow error.. why? Fingerjob Excel Discussion (Misc queries) 4 November 13th 06 05:18 PM
Overflow Error DG Excel Discussion (Misc queries) 3 April 15th 05 05:45 PM
Overflow error Jim Berglund Excel Programming 3 January 30th 05 05:57 PM
Help! Overflow Error 6 Gauthier Excel Programming 6 September 24th 04 12:57 PM
overflow error ExcelMonkey[_5_] Excel Programming 6 January 22nd 04 02:34 AM


All times are GMT +1. The time now is 07:12 PM.

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"