PDA

View Full Version : Formatting not alligning properly on macro run



BigDawg15
06-07-2012, 09:31 AM
I have modified the excellet code provided in this forum from a recent post (My current count will not let me add link).

I think I have edited all the appropriate ranges but I'm obviously missing something and cannot figure out why it will not allign properly when running the macro.

Thank you in advance for any assistance.

BigDawg15


8214

dazwm
06-08-2012, 11:53 PM
What exactly are you trying to do?

BigDawg15
06-09-2012, 09:15 AM
dazwm,

Thank you for your reply. When the macro is run it currently creates calendars according to the date entered, however the day and date columns are not alligned with the name columns (run the macro and you will see what I mean).

I have modified the macros which were found in these forums, but I am missing something that is throwing off the allignment.

I am open to any suggestions to consolidate or to a better way of doing it, I am just working with what I have.

Thank you again for your time,

BigDawg15

dazwm
06-09-2012, 09:22 AM
I am not sure I understand what you mean, but you could add something like below at the end of your code



Cells.Select
Cells.EntireColumn.AutoFit

BigDawg15
06-09-2012, 09:28 AM
dazwm,

Sorry if I am not explaining this clearly. Lets say in A2 is the name Joe. In D1 is Sun and D2 1 (the first day of the month). When the macro is run to create the new calendar, Sun and 1 are created four or five rows down rather than in D1 and D2 as they should be.

I hope that is a bit clearer.

BigDawg15

Paul_Hossler
06-09-2012, 09:42 AM
however the day and date columns are not alligned with the name columns

I'm not sure what you mean by 'not aligned'

If you mean the vertical alignment of the Col A cells, they are Aligned Bottom, and the Day/Date are Aligned Center

Just put something like this in

With Range("A:A")
.VerticalAlignment = xlCenter
End With


Otherwise, some more details




Lets say in A2 is the name Joe.


I'd have thought that Joe would go in A5, Tom in A6, Mary in A7, etc.

Paul

BigDawg15
06-09-2012, 09:54 AM
Paul,

Thank you for the reply. You are correct in how the names are listed in column A. I understand the allignment of text, that is not the problem. When the macro is run, the day and dates from rows d23:ah24 are moved down to rows d28:ah29 instead of being rewritten to d23:ah24. Likewise with rows d42:ah43.

Is that a bit clearer?

Thank you,

BigDawg15

Paul_Hossler
06-09-2012, 10:39 AM
I'm not sure about the final appearance, but in AddHeaders


'------------- Range("E24").Insert
With Range("E24")
.Formula = "=(D24+1)"
.Font.Name = "Arial"
.Font.Size = 9
.Font.Bold = True
.AutoFill Destination:=.Resize(1, Spread), Type:=xlFillDefault
End With


You are inserting a cell at E24. When I comment it out, it doesn't seem to push it down

Paul

BigDawg15
06-09-2012, 03:05 PM
Paul,

Thanks for that, but I tried commenting that out but it did not make a difference. I've fooled around a bit more with the code and it appears it has something to do with the conditional formatting.

If I comment out the addhighlights portions of the code everything comes out properly aligned, just not with the required shading.

I'm just not sure what is causing the rows to be out of allignment. The conditional formatting is for shading purposes.

Thanks again,

Mike