So i have this code, that unmerges some merged cells and then applies border
then i'm trying to set the value of the empty cells and its not working
The setting of the values is closer to the bottom of the code
There are two checks, one msgbox that says "its here"
and another that says "its here2" after the setting of the values
the second msgbox never comes up and has me very confused
anyone got any ideas?
Function MergeLeftSide1(Target As Variant) If Target.MergeCells = False Then MsgBox ("don't do anything") Else RowCnt = Target.Row ChkCol = 6 NumOfRows = Target.MergeArea.Rows.count NumOfRows = NumOfRows - 1 ActiveSheet.Range(ActiveSheet.Cells(RowCnt, ChkCol - 1), ActiveSheet.Cells(RowCnt + NumOfRows, ChkCol + 3)).Select With Selection .UnMerge .HorizontalAlignment = xlCenter .VerticalAlignment = xlCenter .WrapText = False .Orientation = 0 .AddIndent = False .IndentLevel = 0 .ShrinkToFit = False .ReadingOrder = xlContext End With ActiveSheet.Range(ActiveSheet.Cells(RowCnt, ChkCol - 1), ActiveSheet.Cells(RowCnt, ChkCol + 3)).Select With Selection.Borders(xlEdgeLeft) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlEdgeTop) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlEdgeBottom) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlEdgeRight) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With MsgBox ("its here") ActiveSheet.Range(Cells(RowCnt + NumOfRows, ChkCol - 1)).Select ActiveCell.FormulaR1C1 = "30" ActiveSheet.Range(Cells(RowCnt + NumOfRows, ChkCol)).Select ActiveCell.FormulaR1C1 = "12" MsgBox ("its here 2") End If End Function
anyone atleast have any ideas why it might be skipping that code?
or appear to be skipping the code
Try running your code as a sub
Functions return values they don't perform actions with objects.
Mick G
yea i tried it outside the function and all is well
thats kinda annoying, but o well
thanks for the help!
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks