The way your code is written says that you only select that cell if the
topleftcell.column > 8.
Otherwise, you just plop the formula into the activecell. Is that what you
really meant?
If no, maybe:
Option Explicit
Sub MonthPlus()
With ActiveSheet.Buttons(Application.Caller).TopLeftCell
If .Column > 8 Then
Cells(.Row - 43, .Column - 8).Select
ActiveCell.FormulaR1C1 = "=R[-2]C+30"
Cells(ActiveCell.Row - 2, ActiveCell.Column + 30).Copy
ActiveCell.PasteSpecial xlFormats
ActiveCell.Font.Bold = True
End If
End With
End Sub
It only puts the formula, copies/pastes the formatting and apply bold if that
topleftcell.column is > 8.
Can I get the result in Bold:
Sub MonthPlus()
With ActiveSheet.Buttons(Application.Caller).TopLeftCell
If .Column > 8 Then Cells(.Row - 43, .Column - 8).Select
ActiveCell.FormulaR1C1 = "=R[-2]C+30" (Bold)
End With
End Sub
TIA Bob
Tom, that doesn't work, it only produces the numbers 38210, the cell is
not
formatted for the date that's why I wanted to bring the format with it,
because I use the cell as a general number cell when I don't need the
month
put in it, Thanks Bob
Sub MonthPlus()
With ActiveSheet.Buttons(Application.Caller).TopLeftCell
If .Column > 8 Then Cells(.Row - 43, .Column - 8).Select
ActiveCell.FormulaR1C1 = "=R[-2]C+30"
Cells(Activecell.row-2,ActiveCell.Column+30).Copy
ActiveCell.PasteSpecial xlFormats
End With
End Sub
--
Regards,
Tom Ogilvy
--
After searching Google.groups.com and finding no answer, Bob Vance
asked:
Can "CopyFormat" be added to this code
Sub MonthPlus()
With ActiveSheet.Buttons(Application.Caller).TopLeftCell
If .Column > 8 Then Cells(.Row - 43, .Column - 8).Select
ActiveCell.FormulaR1C1 = "=R[-2]C+30"
End With
End Sub
Thanks in advance.........Bob Vance