mgunia 0 Newbie Poster

Hello. I would like to ask for a help. I deal with excel spread sheets and very often I need to amend specific column. The whole steps look like this:

Step 1. Find the column name, Step 2. Mark the all populated rows in this column, Step 3. Proceed with certain action (action means mostly find and replace or if other column is “this” then amend my column for “that)
I would like to have a macro template which would have those first 2 steps specified and leave me the space to amend the code easily for proceeding with step 3.

So far I have a macro which indeed does a similar job but unfortunately doesn’t work for my (by now). It searches for the specific column name, it marks all rows populated but it doesn’t allow me to easily process with other macros which I have found on the internet (to just simply copy and paste them to the main macro.

Let me show the example

MACRO WHICH FINDS THE COLUMN NAME AND MARKS ALL RECORDS IN THS COLUMN

Sub FindAddressColumn()
  Dim rngAddress As Range
  Set rngAddress = Range("A1:ZZ1").Find("Address")
  If rngAddress Is Nothing Then
    MsgBox "Address column was not found."
    Exit Sub
  End If
  Range(rngAddress, rngAddress.End(xlDown)).Select
End Sub

And if I want to paste the code of find and replace macro I have a problem as most of macros found on the internet have the column specified (same as the macro below)

EXAMPLE OF A MACRO THAT I WOULD LIKE TO ADD TO THE MAIN MACRO:

Sub GOOD_WORKS_Find_Replace_Commas_in_Emails()
    Sheets("Data").Activate
    Dim i As String
    Dim k As String
    i = ","
    k = "."
    Columns("R").Replace What:=i, Replacement:=k, LookAt:=xlPart, MatchCase:=False
    Sheets("Automation").Activate
    MsgBox "Removing commas in emails - Done!"
End Sub

I believe what I miss is the code which will “say” for the already marked rows do …. And here you paste only the part of the code found on the internet.

I would really appreciate if someone could help me to create such macro template as it would improve my daily tasks significantly. I have limited knowledge of VBA, so amended codes would be much appreciated.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.