Getting a weird problem with left aligning a Shapes to a range of cells. It seems to work when there is no ListObject on the sheet, but when a ListObject is present the left alignment slowly 'creeps' to the right such that after about 20 columns the shape is visibly out of alignment with the cell.
If you paste the below into a module in a new workbook then run it once and all the shapes should be aligned. Then uncomment the line that creates the ListObject and run again - the shapes move to the right.
Hope someone has an idea on a fix and/or hack!
Public Sub WierdAlignment()
Dim ws As Worksheet
Dim MonthNum As Long
Dim lo As ListObject
Dim vStartMonth As Date
Dim cell As Range
Dim shp As Shape
Set ws = ActiveSheet
' Clean up before testing
For Each shp In ws.Shapes
shp.Delete
Next shp
For Each lo In ws.ListObjects
lo.Delete
Next lo
Cells.Delete
vStartMonth = Now()
MonthNum = 0
' Run once, then uncomment this line
' Set lo = ws.ListObjects.Add(xlSrcRange, ws.Range("B5:AZ10"))
For Each cell In Range("B5:AZ5")
Set shp = ws.Shapes.AddTextbox(msoTextOrientationHorizontal, cell.Left, cell.Top - 20, 1, 15)
shp.TextFrame.AutoSize = True
With shp.TextFrame2.TextRange.Characters
.Font.Size = 8
.Text = Format(DateAdd("m", MonthNum, vStartMonth), "Mmm-YYYY")
End With
shp.Left = cell.Left ' doing it again after it is populated...
MonthNum = MonthNum + 1
Next cell
End Sub