Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 394
Default Using DEC2BIN(range,6) in VBA Code

Hi everyone,

At the moment I input the vales 0 to 63 in cells "B2:B65".
I input the Formula =DEC2BIN(B2,6) into cell "C2" and copy it down to
cell "C65".
The =DEC2BIN(range,6) is an engineering function that converts
"Decimal" to "Binary". For anybody wanting to use this the Analysis
ToolPak needs to be installed (which I have).

I have the code :-

Range("A1").Select

For I = 1 To 64
ActiveCell.Offset(I, 2).Value = nSum(I)
Next I

The output starts in cell "D2" and continues down to cell "D65" and
works great.
Is there anyway that I can use the DEC2BIN(range,6) so the code
calculates it and outputs the answer, preferably not getting it to
output the formula itself into the worksheet. I would ideally like the
figures produced to be output to cells "C2:C65" please.

Thanks in Advance.
All the Best.
Paul

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Using DEC2BIN(range,6) in VBA Code

For i = 2 to 65
Cells(i,"C").Value = Application.Run("ATPVBAEN.XLA!DEC2BIN",Cells(i,"B" ))
Next
--
Regards,
Tom Ogilvy


"Paul Black" wrote:

Hi everyone,

At the moment I input the vales 0 to 63 in cells "B2:B65".
I input the Formula =DEC2BIN(B2,6) into cell "C2" and copy it down to
cell "C65".
The =DEC2BIN(range,6) is an engineering function that converts
"Decimal" to "Binary". For anybody wanting to use this the Analysis
ToolPak needs to be installed (which I have).

I have the code :-

Range("A1").Select

For I = 1 To 64
ActiveCell.Offset(I, 2).Value = nSum(I)
Next I

The output starts in cell "D2" and continues down to cell "D65" and
works great.
Is there anyway that I can use the DEC2BIN(range,6) so the code
calculates it and outputs the answer, preferably not getting it to
output the formula itself into the worksheet. I would ideally like the
figures produced to be output to cells "C2:C65" please.

Thanks in Advance.
All the Best.
Paul


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 394
Default Using DEC2BIN(range,6) in VBA Code

Thanks for the reply Tom,

Is there a way so I don't need to actually input the 0 to 63 values in
the spreadsheet please. What I mean by that is get the program to
calculate the 0 to 63 and use them instead of the spreadsheet figures
because I don't actually need the 0 to 63 figures at all, they are
only there to work out the DEC2BIN(range,6) values.

Thanks in Advance.
All the Best.
Paul

On Sep 26, 12:38 pm, Tom Ogilvy
wrote:
For i = 2 to 65
Cells(i,"C").Value = Application.Run("ATPVBAEN.XLA!DEC2BIN",Cells(i,"B" ))
Next
--
Regards,
Tom Ogilvy



"Paul Black" wrote:
Hi everyone,


At the moment I input the vales 0 to 63 in cells "B2:B65".
I input the Formula =DEC2BIN(B2,6) into cell "C2" and copy it down to
cell "C65".
The =DEC2BIN(range,6) is an engineering function that converts
"Decimal" to "Binary". For anybody wanting to use this the Analysis
ToolPak needs to be installed (which I have).


I have the code :-


Range("A1").Select


For I = 1 To 64
ActiveCell.Offset(I, 2).Value = nSum(I)
Next I


The output starts in cell "D2" and continues down to cell "D65" and
works great.
Is there anyway that I can use the DEC2BIN(range,6) so the code
calculates it and outputs the answer, preferably not getting it to
output the formula itself into the worksheet. I would ideally like the
figures produced to be output to cells "C2:C65" please.


Thanks in Advance.
All the Best.
Paul- Hide quoted text -


- Show quoted text -



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 394
Default Using DEC2BIN(range,6) in VBA Code

Hi Tom,

It has come up with an error saying that ATPVBAEN.XLA!DEC2BIN cannot
be found and make sure it is installed, which it is. Is this because
ATPVBAEN.XLA!BIN2DEC exists but not ATPVBAEN.XLA!DEC2BIN please.

Thanks in Advance.
All the Best.
Paul

On Sep 26, 12:48 pm, Paul Black wrote:
Thanks for the reply Tom,

Is there a way so I don't need to actually input the 0 to 63 values in
the spreadsheet please. What I mean by that is get the program to
calculate the 0 to 63 and use them instead of the spreadsheet figures
because I don't actually need the 0 to 63 figures at all, they are
only there to work out the DEC2BIN(range,6) values.

Thanks in Advance.
All the Best.
Paul

On Sep 26, 12:38 pm, Tom Ogilvy
wrote:



For i = 2 to 65
Cells(i,"C").Value = Application.Run("ATPVBAEN.XLA!DEC2BIN",Cells(i,"B" ))
Next
--
Regards,
Tom Ogilvy


"Paul Black" wrote:
Hi everyone,


At the moment I input the vales 0 to 63 in cells "B2:B65".
I input the Formula =DEC2BIN(B2,6) into cell "C2" and copy it down to
cell "C65".
The =DEC2BIN(range,6) is an engineering function that converts
"Decimal" to "Binary". For anybody wanting to use this the Analysis
ToolPak needs to be installed (which I have).


I have the code :-


Range("A1").Select


For I = 1 To 64
ActiveCell.Offset(I, 2).Value = nSum(I)
Next I


The output starts in cell "D2" and continues down to cell "D65" and
works great.
Is there anyway that I can use the DEC2BIN(range,6) so the code
calculates it and outputs the answer, preferably not getting it to
output the formula itself into the worksheet. I would ideally like the
figures produced to be output to cells "C2:C65" please.


Thanks in Advance.
All the Best.
Paul- Hide quoted text -


- Show quoted text -- Hide quoted text -


- Show quoted text -



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Using DEC2BIN(range,6) in VBA Code

Also, I guess you said you wanted a 6 character result, so this does that:

Sub BBB()
For i = 2 To 62
Cells(i, 2) = "'" & _
Application.Run("ATPVBAEN.XLA!DEC2BIN", i - 2, 6)
Next

End Sub

starting in B1:

000000
000001
000010
000011
000100
000101
000110
000111
001000
001001

.. . .

--
regards,
Tom Ogilvy



"Paul Black" wrote:

Hi Tom,

It has come up with an error saying that ATPVBAEN.XLA!DEC2BIN cannot
be found and make sure it is installed, which it is. Is this because
ATPVBAEN.XLA!BIN2DEC exists but not ATPVBAEN.XLA!DEC2BIN please.

Thanks in Advance.
All the Best.
Paul

On Sep 26, 12:48 pm, Paul Black wrote:
Thanks for the reply Tom,

Is there a way so I don't need to actually input the 0 to 63 values in
the spreadsheet please. What I mean by that is get the program to
calculate the 0 to 63 and use them instead of the spreadsheet figures
because I don't actually need the 0 to 63 figures at all, they are
only there to work out the DEC2BIN(range,6) values.

Thanks in Advance.
All the Best.
Paul

On Sep 26, 12:38 pm, Tom Ogilvy
wrote:



For i = 2 to 65
Cells(i,"C").Value = Application.Run("ATPVBAEN.XLA!DEC2BIN",Cells(i,"B" ))
Next
--
Regards,
Tom Ogilvy


"Paul Black" wrote:
Hi everyone,


At the moment I input the vales 0 to 63 in cells "B2:B65".
I input the Formula =DEC2BIN(B2,6) into cell "C2" and copy it down to
cell "C65".
The =DEC2BIN(range,6) is an engineering function that converts
"Decimal" to "Binary". For anybody wanting to use this the Analysis
ToolPak needs to be installed (which I have).


I have the code :-


Range("A1").Select


For I = 1 To 64
ActiveCell.Offset(I, 2).Value = nSum(I)
Next I


The output starts in cell "D2" and continues down to cell "D65" and
works great.
Is there anyway that I can use the DEC2BIN(range,6) so the code
calculates it and outputs the answer, preferably not getting it to
output the formula itself into the worksheet. I would ideally like the
figures produced to be output to cells "C2:C65" please.


Thanks in Advance.
All the Best.
Paul- Hide quoted text -


- Show quoted text -- Hide quoted text -


- Show quoted text -






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 394
Default Using DEC2BIN(range,6) in VBA Code

Thanks Tom,

I started with a blank worksheet and amended the code as per your
instructions.
It still keeps saying ATPVBAEN.XLA could NOT be found though.

Thanks in Advance.
All the Best.
Paul

On Sep 26, 1:28 pm, Tom Ogilvy
wrote:
Also, I guess you said you wanted a 6 character result, so this does that:

Sub BBB()
For i = 2 To 62
Cells(i, 2) = "'" & _
Application.Run("ATPVBAEN.XLA!DEC2BIN", i - 2, 6)
Next

End Sub

starting in B1:

000000
000001
000010
000011
000100
000101
000110
000111
001000
001001

. . .

--
regards,
Tom Ogilvy



"Paul Black" wrote:
Hi Tom,


It has come up with an error saying that ATPVBAEN.XLA!DEC2BIN cannot
be found and make sure it is installed, which it is. Is this because
ATPVBAEN.XLA!BIN2DEC exists but not ATPVBAEN.XLA!DEC2BIN please.


Thanks in Advance.
All the Best.
Paul


On Sep 26, 12:48 pm, Paul Black wrote:
Thanks for the reply Tom,


Is there a way so I don't need to actually input the 0 to 63 values in
the spreadsheet please. What I mean by that is get the program to
calculate the 0 to 63 and use them instead of the spreadsheet figures
because I don't actually need the 0 to 63 figures at all, they are
only there to work out the DEC2BIN(range,6) values.


Thanks in Advance.
All the Best.
Paul


On Sep 26, 12:38 pm, Tom Ogilvy
wrote:


For i = 2 to 65
Cells(i,"C").Value = Application.Run("ATPVBAEN.XLA!DEC2BIN",Cells(i,"B" ))
Next
--
Regards,
Tom Ogilvy


"Paul Black" wrote:
Hi everyone,


At the moment I input the vales 0 to 63 in cells "B2:B65".
I input the Formula =DEC2BIN(B2,6) into cell "C2" and copy it down to
cell "C65".
The =DEC2BIN(range,6) is an engineering function that converts
"Decimal" to "Binary". For anybody wanting to use this the Analysis
ToolPak needs to be installed (which I have).


I have the code :-


Range("A1").Select


For I = 1 To 64
ActiveCell.Offset(I, 2).Value = nSum(I)
Next I


The output starts in cell "D2" and continues down to cell "D65" and
works great.
Is there anyway that I can use the DEC2BIN(range,6) so the code
calculates it and outputs the answer, preferably not getting it to
output the formula itself into the worksheet. I would ideally like the
figures produced to be output to cells "C2:C65" please.


Thanks in Advance.
All the Best.
Paul- Hide quoted text -


- Show quoted text -- Hide quoted text -


- Show quoted text -- Hide quoted text -


- Show quoted text -



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Using DEC2BIN(range,6) in VBA Code

? application.Run( "ATPVBAEN.XLA!DEC2BIN",125)
1111101

works fine as you can see from the above demo in the immediate window

Sub ABC()
for i = 2 to 62
cells(i,2) = application.Run( "ATPVBAEN.XLA!DEC2BIN",i-2)
Next
end sub


starting in B2 produced:

0
1
10
11
100
101
110
111
1000
1001
.. . .


--
Regards,
Tom Ogilvy

"Paul Black" wrote:

Hi Tom,

It has come up with an error saying that ATPVBAEN.XLA!DEC2BIN cannot
be found and make sure it is installed, which it is. Is this because
ATPVBAEN.XLA!BIN2DEC exists but not ATPVBAEN.XLA!DEC2BIN please.

Thanks in Advance.
All the Best.
Paul

On Sep 26, 12:48 pm, Paul Black wrote:
Thanks for the reply Tom,

Is there a way so I don't need to actually input the 0 to 63 values in
the spreadsheet please. What I mean by that is get the program to
calculate the 0 to 63 and use them instead of the spreadsheet figures
because I don't actually need the 0 to 63 figures at all, they are
only there to work out the DEC2BIN(range,6) values.

Thanks in Advance.
All the Best.
Paul

On Sep 26, 12:38 pm, Tom Ogilvy
wrote:



For i = 2 to 65
Cells(i,"C").Value = Application.Run("ATPVBAEN.XLA!DEC2BIN",Cells(i,"B" ))
Next
--
Regards,
Tom Ogilvy


"Paul Black" wrote:
Hi everyone,


At the moment I input the vales 0 to 63 in cells "B2:B65".
I input the Formula =DEC2BIN(B2,6) into cell "C2" and copy it down to
cell "C65".
The =DEC2BIN(range,6) is an engineering function that converts
"Decimal" to "Binary". For anybody wanting to use this the Analysis
ToolPak needs to be installed (which I have).


I have the code :-


Range("A1").Select


For I = 1 To 64
ActiveCell.Offset(I, 2).Value = nSum(I)
Next I


The output starts in cell "D2" and continues down to cell "D65" and
works great.
Is there anyway that I can use the DEC2BIN(range,6) so the code
calculates it and outputs the answer, preferably not getting it to
output the formula itself into the worksheet. I would ideally like the
figures produced to be output to cells "C2:C65" please.


Thanks in Advance.
All the Best.
Paul- Hide quoted text -


- Show quoted text -- Hide quoted text -


- Show quoted text -




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
What 'value' is a Dec2Bin output? EvilTony Excel Discussion (Misc queries) 12 April 13th 09 01:59 PM
=Dec2bin can you increase the number bits please WAT Excel Discussion (Misc queries) 0 July 29th 06 01:20 AM
How to get leading zeros using DEC2BIN scallyte Excel Worksheet Functions 2 December 8th 05 11:52 PM
dec2bin Jo Excel Programming 5 November 9th 04 08:19 PM
dec2bin Jo[_6_] Excel Programming 1 November 9th 04 04:47 PM


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