You can find the Excel tips you're looking at Pro-business Excel VBA Programming by entering the keyword in the textbox below and clicking the "Google Search" button.
Showing posts with label Simple Tips. Show all posts
Showing posts with label Simple Tips. Show all posts

Tuesday, April 29, 2008

Resizing Excel Radio Button's Font

Someone asked me today on how to change the size of radio button's font. In this kind of situation, the first thing that comes to mind is to use the font resizing function for the cells. But, you can not use it to a form control like the radio button.

To change the font size of a form control, right click on the radio button and choose "Properties" in the pop-up menu that appears. The properties window will be displayed as shown in the screen shot below:



Click the 3-dot button at the rightmost portion of the "Font" property. The font window will appear and therefore you can change the radio button's font. The font window looks like the following figure:



After choosing the size you desire, click the "Ok" button.

You're done.



Click here to subscribe and receive Pro-business Excel VBA Programming tips.


If you like this post in Pro-business Excel VBA Programming, buy me a coffee.


Thursday, April 10, 2008

2 Ways Of Renaming A File In VBA

Sometimes in your business application programming using VBA, you'll find yourself in a situation wherein you need to rename a file. Macro Recording at this point will not be helpful as you cannot do the renaming in Excel interactivity. Here are two ways of doing it at a VBA level:

Sub DoRename()
Name "c:\test.xls" As "c:\test2.xls"
End Sub

Another way of doing it is by using the CreateObject function:

Sub DoRename()
Dim fso As Object
Set fso = CreateObject("Scripting.FileSystemObject")
fso.MoveFile "c:\test.xls", "c:\test2.xls"
Set fso = Nothing
End Sub

Another function of this two routines is that it can be used to move a file from folder to another. Here are examples:

Sub DoMove()
Name "c:\folder1\test.xls" As "c:\folder2\test.xls"
End Sub

Moving a file using CreateObject function:

Sub DoRename()
Dim fso As Object
Set fso = CreateObject("Scripting.FileSystemObject")
fso.MoveFile "c:\folder1\test.xls", "c:\folder2\test.xls"
Set fso = Nothing
End Sub




Click here to subscribe and receive Pro-business Excel VBA Programming tips.


If you like this post in Pro-business Excel VBA Programming, buy me a coffee.


Tuesday, April 8, 2008

Limit The Worksheet Scrolling

A few days ago, somebody asked me how to limit the scrolling of a worksheet as soon as he opened his workbook file. He intended to make the first sheet as a Title Page so he should find a way to do it. At first, I thought it was just a simple Excel "setup" workaround at the Tools menu. But after a few minutes of looking around it, I didn't find a way to do the task (or maybe there was one but I didn't find it). So, I ended up making a simple Macro program at the workbook's "Open" event. Here's how I did it:

Private Sub Workbook_Open()
Sheets("Sheet1").ScrollArea = "a1:f10"
End Sub

The code limits the scrolling of the worksheet from cell A1 to F10 only.

Try it.



Click here to subscribe and receive Pro-business Excel VBA Programming tips.


If you like this post in Pro-business Excel VBA Programming, buy me a coffee.