Change font size based on the value in another cell

erikd

New Member
Joined
Feb 21, 2012
Messages
2
Hi,

So, I have a worksheet with two columns I have to work with. In the first column is a word, and in the second column is a number. I have to change the font size of the word to the number in the other column. I'm not finding anything close enough to edit to suit my needs. Any help you can provide would be greatly appreciated. There are a lot of words!

Thanks
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Hi and welcome to the Board
Try
Code:
Sub fontchange()
For Each c In Range("A1:A100")'change to suit
    c.Font.Size = c.Offset(, 1).Value 'this is one column to the right, -1 for 1 column to the left
Next c
End Sub
[/code]
 
Upvote 0
That worked beautifully. Thank you so much. It does stall if there's a 0 in the cell, but for my purposes I had to set that to size 1 anyway.

Hi and welcome to the Board
Try
Code:
Sub fontchange()
For Each c In Range("A1:A100")'change to suit
    c.Font.Size = c.Offset(, 1).Value 'this is one column to the right, -1 for 1 column to the left
Next c
End Sub
[/code]
 
Upvote 0
Glad it worked ...thanks for the feedback, you colud change to
Code:
Sub fontchange()
For Each c In Range("A1:A100")'change to suit
on error resume next    
c.Font.Size = c.Offset(, 1).Value 'this is one column to the right, -1 for 1 column to the left
Next c
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,589
Messages
6,120,415
Members
448,960
Latest member
AKSMITH

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top