Using the left-function

I'm trying to create a simple macro that copys the two first numbers in each cell in a column and printing them in a different column. This is in a excel-document with more than 1 worksheet. I've tried for a while to write the code, but with no prior experience, I have a hard time figuring out what to do. I know the "left()"-function is able to do this, but I don't know how I define which column to draw data from and to which column it will be printed. Any help will be greatly appreciated.


With no prior experience to writing VBA code, I am going to reccommend you stick to the formula method of doing. Honestly, even if you were familiar with VBA, you might still opt to use the formula.

A formula is put into the actual cell you want the value to be copied.

=LEFT(sourceCell, #of characters you want)

This is how it would look:

=LEFT(Sheet1!A1, 2)

Think of it as saying "this cell shall equal the first n characters in cell OO, starting from the left".

Once you are done with your formula, if you don't need it to be binded to the source anymore (if the sourceCell changes, so does the cell with the LEFT formula), you can highlight the cells, Ctrl + C to copy, then right-click and select Paste Special. Then select VALUE and hit OK and now the cells are hard-coded with the value they were showing, as if you typed it yourself.

Once you master using formulas, the next step is VBA. Don't go confusing yourself by jumping into VBA and writing code for ranges, etc. if you aren't comfortable with using =LEFT yet. One step at a time, and you'll be a pro before you know it. :)

Need Your Help

Using a self-signed certificate with .NET's HttpWebRequest/Response

c# ssl httpwebrequest ssl-certificate

I'm trying to connect to an API that uses a self-signed SSL certificate. I'm doing so using .NET's HttpWebRequest and HttpWebResponse objects. And I'm getting an exception that:

Exception causes Android App to infrequently crash on startup and become a zombie process


I write an app and everything is ok. But sometimes (usually after a hard test of app features), when I start app, it starts and stops quickly with a force close error dialog and app will not run ag...