Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Snapping to Grid?? Is there a better way??

Status
Not open for further replies.

ribhead

Technical User
Jun 2, 2003
384
US
I have several shapes that I need to have snapped to grid (Cosmetic purposes only). Is snap to grid only temporary? If I close and come back the shapes are no longer snapping to the grid. This is the code I have.


The problem is if a new objec gets copied then it won't snap to grid.

Sub auto_open()
For Each obj In ActiveSheet.DrawingObjects
With obj
.Top = .TopLeftCell.Top
.Left = .TopLeftCell.Left
End With
Next
End Sub

I may not be very smart but I'm sure wirey!!!!
 
Hey Rib,

There is no, "snap to grid" feature in Excel as in Power Point. I suppose that you are referring to aligning your drawing objects with the top left cell.

I inserted several drawing objects and copied a couple, alligned them using your macro, saved & closed the workbook and opened it. I could see no instances of missaligned drawing objects.

???

Skip,
Skip@TheOfficeExperts.com
 
Hey skip, here is my problem. If I use snap to grid on an object whenever I move that object it will snap to grid....right? O.K. when I close the WB and reopen it then the objects lose their Snap to grid "property" I was hoping that there was something in an Auto_Open() module that would give all objects that Snap to grid "property".

C Wut I'm saying ?

I may not be very smart but I'm sure wirey!!!!
 
Excel 2000

For just $19.95 you too can have a beautiful smile.
 
I finally found the Drawing Object Align "Snap To..." feature.

This is a spreadsheet design feature that gets reset when Excel opens. It cannot be accessed by VBA. There are 4 states to the Snap To feature. Excel seems to open with no Snap To selected.

You could use your macro in the Workbook_Open event to align each drawing object as you have coded, but there is really no purpose for running it if the drawing objects have been previously aligned before saving.

Hope this helps :)

Skip,
Skip@TheOfficeExperts.com
 
I'm not following you entirely here but my problem is I'm not going to be the one using the spreadsheet so when the other user copies a shape it won't have the snap to grid. So.....if I read your post right I'm screwed blewed and uhhhhhhhh yah.

For just $19.95 you too can have a beautiful smile.
 
I can't even count on this guy to brush his teeth in the morning let alone push a button. Too bad I can't have a macro like the Auto_Open called After_Paste(). Life would be great then.

For just $19.95 you too can have a beautiful smile.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top