How can i combine these two bits of code so that when you put it in a worksheet selection change event it works correctly? 1st bit works correctly but to place the cell contents in and out of the cell depending on the condition you have to merge and unmerge the range in the second bit to get it to insert.
[vba]Select Case Sheets("Input + Wksheet").Range("B13")
Case "Y"
Sheets("Direct Bill ONLY").Range("c48") = Sheets("Input + Wksheet").Range("A161")
Case "N"
Sheets("Direct Bill ONLY").Range("c48") = Sheets("Input + Wksheet").Range("A163")
End Select[/vba]
this is a recorded macro:
[vba]Range("C48:U48").Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.UnMerge
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
Selection.Merge
End Sub[/vba]