Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9111517
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T03:31:30+00:00 2026-06-17T03:31:30+00:00

I am trying to create a macro in excel 2010 that finds every cell

  • 0

I am trying to create a macro in excel 2010 that finds every cell in a sheet with a value of “All Customers.” Every time that value is found I need a blank row inserted below it. Thought it would be pretty simple but I have searched I many forums and tried to use some sample code and I can’t get it to work properly. I am a complete newb when it comes to VBA stuff. Thought I would post here and go do some light reading on basics of VBA.

If anyone has any good training resources, please post those as well.

Thanks in advance!

EDIT: In my OP, I neglected to mention that any row that contains a value of “All Customers” would ideally be highlighted and put in bold, increased size font.

These actions are something that an old Crystal Report viewing/formatting program used to handle automatically when pulling the report. After we upgraded the program I learned that this type of formatting ability had been removed with the release of the newer version of the program, according to the software manufacturer’s tech support. Had this been defined in the release notes I would have not performed the upgrade. Regardless, that is how I found myself in this macro disaster.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T03:31:31+00:00Added an answer on June 17, 2026 at 3:31 am

    Something like this code adpated from an article of mine here is efficient and avoids looping

    1. It bolds and increase the font size where the text is found (in the entire row, as Tim points out you should specify whether you meant by cell only)
    2. It adds a blank row below the matches

    code

    Option Explicit
    
    Const strText As String = "All Customers"
    
    Sub ColSearch_DelRows()
        Dim rng1 As Range
        Dim rng2 As Range
        Dim rng3 As Range
        Dim cel1 As Range
        Dim cel2 As Range
        Dim strFirstAddress As String
        Dim lAppCalc As Long
        Dim bParseString As Boolean
    
        'Get working range from user
        On Error Resume Next
        Set rng1 = Application.InputBox("Please select range to search for " & strText, "User range selection", ActiveSheet.UsedRange.Address(0, 0), , , , , 8)
        On Error GoTo 0
        If rng1 Is Nothing Then Exit Sub
    
        'Further processing of matches
        bParseString = True
    
        With Application
            lAppCalc = .Calculation
            .ScreenUpdating = False
            .Calculation = xlCalculationManual
        End With
    
        'a) match string to entire cell, case insensitive
        'Set cel1 = rng1.Find(strText, , xlValues, xlWhole, xlByRows, , False)
    
        'b) match string to entire cell, case sensitive
        'Set cel1 = rng1.Find(strText, , xlValues, xlWhole, xlByRows, , True)
    
        'c)match string to part of cell, case insensititive
         Set cel1 = rng1.Find(strText, , xlValues, xlPart, xlByRows, , False)
    
        'd)match string to part of cell, case sensititive
        ' Set cel1 = rng1.Find(strText, , xlValues, xlPart, xlByRows, , True)
    
        'A range variable - rng2 - is used to store the range of cells that contain the string being searched for
        If Not cel1 Is Nothing Then
            Set rng2 = cel1
            strFirstAddress = cel1.Address
            Do
                Set cel1 = rng1.FindNext(cel1)
                Set rng2 = Union(rng2.EntireRow, cel1)
            Loop While strFirstAddress <> cel1.Address
        End If
    
        'Further processing of found range if required
        If bParseString Then
            If Not rng2 Is Nothing Then
            With rng2
            .Font.Bold = True
            .Font.Size = 20
            .Offset(1, 0).EntireRow.Insert
            End With
        End If
        End If
    
        With Application
            .ScreenUpdating = True
            .Calculation = lAppCalc
        End With
    
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create a Macro in Excel 2007 that will delete itself when
I'm trying to create a macro that produces in-cell graphing as seen over at
I'm trying to create a Macro that copies variable columns from one sheet to
ok so im trying to create a macro that will take my set cells
I am trying to create a Macro that either runs on close or on
I am trying to create a macro that executes blocks of code only if
I am trying to create a macro that brings in the name of the
I'm trying to create a macro that selects most of the sheets in the
I am trying to create a macro for an Excel file which has a
I am trying to create a macro that takes a scope as a parameter.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.