![]() |
Any way to center a graphic in a particular cell?
I have a small graphic that I need into insert to every applicable cell, in a certain column. Is there any sort of way that excel can be formatted to have this graphic be centered in each cell? It is quite tough to keep everything centered by hand. Thanks! -- metalsped ------------------------------------------------------------------------ metalsped's Profile: http://www.excelforum.com/member.php...o&userid=22824 View this thread: http://www.excelforum.com/showthread...hreadid=539392 |
Any way to center a graphic in a particular cell?
Yay, pity bump. -- metalsped ------------------------------------------------------------------------ metalsped's Profile: http://www.excelforum.com/member.php...o&userid=22824 View this thread: http://www.excelforum.com/showthread...hreadid=539392 |
Any way to center a graphic in a particular cell?
Graphics float over cells, so they aren't affected by cell formatting.
You could use programming to centre the graphics, but there's no built-in command that will centre them. metalsped wrote: I have a small graphic that I need into insert to every applicable cell, in a certain column. Is there any sort of way that excel can be formatted to have this graphic be centered in each cell? It is quite tough to keep everything centered by hand. Thanks! -- Debra Dalgleish Contextures http://www.contextures.com/tiptech.html |
Any way to center a graphic in a particular cell?
Well this is for work, so it needs to be professional looking. Provided I dont have to write an encyclopedia worth of commands for every box, I would love to try out the program (if you know it). Thanks Debra Dalgleish Wrote: Graphics float over cells, so they aren't affected by cell formatting. You could use programming to centre the graphics, but there's no built-in command that will centre them. metalsped wrote: I have a small graphic that I need into insert to every applicable cell, in a certain column. Is there any sort of way that excel can be formatted to have this graphic be centered in each cell? It is quite tough to keep everything centered by hand. Thanks! -- Debra Dalgleish Contextures http://www.contextures.com/tiptech.html -- metalsped ------------------------------------------------------------------------ metalsped's Profile: http://www.excelforum.com/member.php...o&userid=22824 View this thread: http://www.excelforum.com/showthread...hreadid=539392 |
Any way to center a graphic in a particular cell?
Assuming the graphics are narrower than the columns, you could use code
similar to the following: '==================== Sub CentreGraphics() Dim shp As Shape For Each shp In ActiveSheet.Shapes shp.Left = shp.TopLeftCell.Left _ + (shp.TopLeftCell.Width - shp.Width) / 2 Next shp End Sub '===================== metalsped wrote: Well this is for work, so it needs to be professional looking. Provided I dont have to write an encyclopedia worth of commands for every box, I would love to try out the program (if you know it). Thanks Debra Dalgleish Wrote: Graphics float over cells, so they aren't affected by cell formatting. You could use programming to centre the graphics, but there's no built-in command that will centre them. metalsped wrote: I have a small graphic that I need into insert to every applicable cell, in a certain column. Is there any sort of way that excel can be formatted to have this graphic be centered in each cell? It is quite tough to keep everything centered by hand. Thanks! -- Debra Dalgleish Contextures http://www.contextures.com/tiptech.html -- Debra Dalgleish Contextures http://www.contextures.com/tiptech.html |
Any way to center a graphic in a particular cell?
I feel quite silly asking, but where exactly in my excel sheet do I put code like that? :confused: Sorry for all the questions. -- metalsped ------------------------------------------------------------------------ metalsped's Profile: http://www.excelforum.com/member.php...o&userid=22824 View this thread: http://www.excelforum.com/showthread...hreadid=539392 |
Any way to center a graphic in a particular cell?
Store the code in a regular code module, as described he
http://www.contextures.com/xlvba01.html To run the code, you can choose ToolsMacroMacros Select the CentreGraphics macro in the list, then click the Run button. metalsped wrote: I feel quite silly asking, but where exactly in my excel sheet do I put code like that? :confused: Sorry for all the questions. -- Debra Dalgleish Contextures http://www.contextures.com/tiptech.html |
Any way to center a graphic in a particular cell?
I'm halfway there. Thank you thus far Debra. It appears with that coding, that it is centered vertically. Is there any way to have it centered horizontally as well? -- metalsped ------------------------------------------------------------------------ metalsped's Profile: http://www.excelforum.com/member.php...o&userid=22824 View this thread: http://www.excelforum.com/showthread...hreadid=539392 |
Any way to center a graphic in a particular cell?
Hi metalsped,
try... Sub CentreGraphics() Dim shp As Shape For Each shp In ActiveSheet.Shapes shp.Left = shp.TopLeftCell.Left _ + (shp.TopLeftCell.Width - shp.Width) / 2 shp.Top = shp.TopLeftCell.Top _ + (shp.TopLeftCell.Height - shp.Height) / 2 Next shp End Sub Ken Johnson |
All times are GMT +1. The time now is 05:55 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com