Merging 2 macros

anthoncl

New Member
Joined
Dec 2, 2021
Messages
9
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
I have another question if I may ask, I am trying to merge 2 macros. The only manual work that is stopping me to combine both macro is Getting the Sum of K column in K1 and V column sum to cell L1

The code which I used to total K and L column is as below
lr = Cells.Find("*", Cells(1, 1), xlFormulas, xlPart, xlByRows, xlPrevious, False).Row

Range("K" & (lr + 1)).Value = "=SUM(K4:K" & lr & ")"
Range("V" & (lr + 1)).Value = "=SUM(V4:V" & lr & ")"

So What I would need is getting Above sum to Cell K1 i.e. K1= Range("K" & (lr + 1)).Value = "=SUM(K4:K" & lr & ")"
&
L1 = Range("V" & (lr + 1)).Value = "=SUM(V4:V" & lr & ")"

Note: Both the cell should not do a past special. It should just bring the amount with "=" formula like we use on our daily use of excel. The reason being the formulas are inter related to to each other.

1638971676909.png
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
So, do you just want the dynamic formula of "=V19" to appear in cell L1?

If so, you can just to this:
VBA Code:
    Range("L1").Formula = "=V" & lr + 1
 
Upvote 0

Forum statistics

Threads
1,214,636
Messages
6,120,668
Members
448,977
Latest member
moonlight6

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top