VBA MACRO-Copy BLANK/EMPTY Cell and PASTE SPECIAL ADD to an entire COLUMN by COLUMN HEADER NAME

LittleZenGirl

New Member
Joined
Jul 24, 2018
Messages
2
Hi All,
I'm trying write a MACRO to do the following (As a small porti of a large MACRO project):

(Consider that I will have a varying number of COLUMNS and ROWS each time the report is generated, so, the columns needed manipulated will be different each time. This is why I need to use Header names.)

1. Select a BLANK cell within the existing report data
2. COPY the cell
3. SELECT all data, except for header, in COLUMN where header name = "PROC#/REV CODE"
4. PASTE SPECIAL ADD (this step is to get two separate sets of data into the same (EQUAL IF) comparable data type.
5. REPEAT this entire process for COLUMN where header name = "FEE RATE".

Thank you SO much for any assistance!
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
LittleZenGirl,

You might consider the following...

Code:
Sub pasteSpeshul()
Dim blank As Range, found1 As Range, found2 As Range

Set blank = Application.InputBox(prompt:="Please select a blank cell.", Type:=8)
If blank.Count > 1 Or blank.Value <> "" Then
    MsgBox "Please try again."
    Exit Sub
Else
    blank.Copy
    Set found1 = ActiveSheet.Rows(1).Find(What:="PROC#/REV CODE", After:=Cells(1, 1), LookIn:=xlFormulas, _
        LookAt:=xlWhole, SearchOrder:=xlByColumns, SearchDirection:=xlPrevious, MatchCase:=False)
    If Not found1 Is Nothing Then
        Range(found1.Offset(1, 0), Cells(Rows.Count, found1.Column).End(xlUp)).PasteSpecial Paste:=xlPasteAll, operation:=xlAdd
    End If
        
    Set found2 = ActiveSheet.Rows(1).Find(What:="FEE RATE", After:=Cells(1, 1), LookIn:=xlFormulas, _
        LookAt:=xlWhole, SearchOrder:=xlByColumns, SearchDirection:=xlPrevious, MatchCase:=False)
    If Not found2 Is Nothing Then
        Range(found2.Offset(1, 0), Cells(Rows.Count, found2.Column).End(xlUp)).PasteSpecial Paste:=xlPasteAll, operation:=xlAdd
    End If
End If
Application.CutCopyMode = False
End Sub

Cheers,

tonyyy
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,196
Members
452,616
Latest member
intern444

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