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: 6
Default How can i get past the overflow error?

i am writing a macro that looks at 306 cells in column A
each cell contains 1 or 0 (representing off and on)

I am trying to make the value increase each time i give a command -
remaining in the binary format)
I know this would be 2^306 combinations, but i promise this is not what i'm
attempting.

The code i have so far (is wrong), shows how i was trying to keep the 306
figures together as a string so i did not have any overflow errors. I
couldn't think of a way to move it up to the next level so was going to try
to multiply the string by 1 and add 1 then work through each character to try
to get 1 to 10 to 11 etc.
I admit the idea is hairbrained, but i'm stumped as to how i can get this to
work so was clutching at straws.

Any advice appreciated.

Sub test()
Dim x As String
Dim i As Range
Dim a As String

For Each i In Range("A1:A306")
p = i.Address
x = x & i.Value
Next i

1
For b = 1 To Len(x)
a = Right(Left(x, b), 1)
If a = 0 Or a = 1 Then
xbinary = True
Else
x = x + 1
GoTo 1
End If
Next b

z = x
'put data back in
For b = 1 To Len(x)
c = Right(Left(z, b), 1)
Range("A" & b).Value = c
Next b

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
Overflow error.. why? Fingerjob Excel Discussion (Misc queries) 4 November 13th 06 05:18 PM
Overflow error Grd Excel Programming 1 January 21st 06 08:13 AM
Overflow Error DG Excel Programming 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


All times are GMT +1. The time now is 03:26 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"