# Is there another way to edit hexidecimals?

**URL:** <https://boards.straightdope.com/t/is-there-another-way-to-edit-hexidecimals/486935>\
**Category:** Factual Questions\
**Created:** [February 22, 2009, 10:26am UTC](https://boards.straightdope.com/t/is-there-another-way-to-edit-hexidecimals/486935 "2009-02-22T10:26:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Saffer](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/saffer/32/6440_2.png) [@Saffer](https://boards.straightdope.com/u/Saffer)\
**Post date:** [February 22, 2009, 10:26am UTC](https://boards.straightdope.com/t/is-there-another-way-to-edit-hexidecimals/486935/1 "2009-02-22T10:26:03Z")

</div>

Hi All!! Long time browser, first time poster here.  
I am normally quite content to expand my brain simply by browsing through this site but I have a question that, despite my best efforts, I cannot figure out. So I am hoping that someone can do it for me.😛  
I am trying to teach myself programming and i’ve started with VBA as it is easy.  
I have made a program that explores the mandelbrot set and have so far been quite successful. Problem is I have to display the result in excel and assign a cell color depending on the escape velocity. If you make all the cells square and zoom right out it looks OK but is very slow. I now want to have my program come up with a bmp instead. I get how the format works but I can’t get VBA to do it. I’ve thought about creating a text file with all the required hexidecimals in the right order and then using a hex editor to paste them into a blank bitmap but the problem is I can’t find a hex editor that will let me copy “FF 00 00 etc” from notepad and paste it into the hex editor to achieve the desired result.😕  
Can anyone think of a way to do this or perhaps, even better, get vba to edit a bitmap directly.  
Or maybe it’s time I start learning a new language…

---

<div class="post-metadata">

**Author:** ![ticker](https://avatars.discourse-cdn.com/v4/letter/t/d07c76/32.png) [@ticker](https://boards.straightdope.com/u/ticker)\
**Post date:** [February 22, 2009, 12:45pm UTC](https://boards.straightdope.com/t/is-there-another-way-to-edit-hexidecimals/486935/2 "2009-02-22T12:45:10Z")

</div>

Hexadecimal is just another way of expressing numbers. What your bitmap requires is bytes whose values - numbers - are often expressed in hex just because it is a convenient notation. I don’t know VBA at all but most programming languages will have some mechanism to write bytes directly, often a Byte data type. Just assign the number you want to a byte and write it directly to the bitmap file.

---

<div class="post-metadata">

**Author:** ![Ximenean](https://avatars.discourse-cdn.com/v4/letter/x/aca169/32.png) [@Ximenean](https://boards.straightdope.com/u/Ximenean)\
**Post date:** [February 22, 2009, 12:55pm UTC](https://boards.straightdope.com/t/is-there-another-way-to-edit-hexidecimals/486935/3 "2009-02-22T12:55:19Z")

</div>

It sounds like you are getting VBS to write the characters F, 0 etc. to a text file, i.e. the ASCII/Unicode codes for them. So in the case of F you are actually writing the number 70 (decimal, or 46 in hex) to the file. What you need to do is write the _values_ F (15 in decimal), 0 etc. to the file, i.e. you should open it as a binary file.  
ISTR that the syntax in VB is something like Open \<filename\> As Binary. Then you can Put, or whatever the syntax is, the contents of numeric variables directly to the file.

---

<div class="post-metadata">

**Author:** ![Saffer](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/saffer/32/6440_2.png) [@Saffer](https://boards.straightdope.com/u/Saffer)\
**Post date:** [February 22, 2009, 1:29pm UTC](https://boards.straightdope.com/t/is-there-another-way-to-edit-hexidecimals/486935/4 "2009-02-22T13:29:03Z")

</div>

Thanks X,

I think you’re on to something about opening in binary.  
I should be able to work it out from here.
