Consolidating Cells Macro

Nroberts

New Member
Joined
Apr 27, 2011
Messages
2
Hi -

I am trying to create a macro to consolidate a proposed budget changes column into an approved budget changes column and then to delete the proposed change value.

Here is what I have so far:

Range("K12").Formula = Range("K12").Formula & "+" & Range("L12").Value
Range("L12").ClearContents

This works fine on its own, but once I begin copying it for the rest of the cells downward, I am getting an error.

Also, is it possible to do this for a range of cells? As in, move all of the proposed changes from L12-K20 into the approved column K12-L20 in one string as opposed to copy/pasting the above text and changing the references.

Thanks for any help!
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Try
Code:
Dim i As Long
For i = 12 To 20
    Range("K" & i).Formula = Range("K" & i).Formula & "+" & Range("L" & i).Value
    Range("L" & i).ClearContents
Next i
 
Upvote 0
Try
Code:
Dim i As Long
For i = 12 To 20
    Range("K" & i).Formula = Range("K" & i).Formula & "+" & Range("L" & i).Value
    Range("L" & i).ClearContents
Next i

I'm receiving an application/user-defined error on this string:

Range("K" & i).Formula = Range("K" & i).Formula & "+" & Range("L" & i).Value

Sorry if I'm not being specific enough, I'm very new to VBA editing and macro writing.
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,289
Members
452,902
Latest member
Knuddeluff

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