Share via

vba code requested to put gridlines and column bottom totals in selected range

Anonymous
2024-07-11T16:36:43+00:00

vba code requested to put gridlines and column bottom totals in selected range

data A1..C50 col A Text Col B Digits Col C digits

Inputbox to select range e.g. A5 TO C20

Have gridlines on this selected range (LineStyle=xlContinuous , weight Light)

and at the botom of B 20 and C 20 have totals of these columns (Like Autosum)

In anticipation

Mr. Pradeep Tikekar

Microsoft 365 and Office | Excel | For education | Other

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

HansV 462.6K Reputation points
2024-07-11T16:52:44+00:00

Sub Test() Dim rng As Range On Error Resume Next Set rng = Application.InputBox(Prompt:="Select a range", Type:=8) On Error GoTo 0 If rng Is Nothing Then Beep Exit Sub End If Set rng = Intersect(Range("A:C"), rng.EntireRow) With rng.Borders .LineStyle = xlContinuous .Weight = xlThin End With With rng.Offset(rng.Rows.Count) .Cells(1, 1).EntireRow.Insert .Cells(0, 2).Formula = "=SUM(" & rng.Columns(2).Address & ")" .Cells(0, 3).Formula = "=SUM(" & rng.Columns(3).Address & ")" End With End Sub

Was this answer helpful?

0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Anonymous
    2024-07-12T12:18:07+00:00

    SIR THE CODE IS WORKING BEAUTIFULLY AND FAR ABOVE MY EXPECTATION. SO THANKFUL TO YOU

    Was this answer helpful?

    0 comments No comments