+ Reply to Thread
Results 1 to 4 of 4

Help adding text to a column during a marco recording

  1. #1
    Registered User
    Join Date
    02-04-2013
    Location
    London, England
    MS-Off Ver
    Excel 2011, mac
    Posts
    45

    Help adding text to a column during a marco recording

    Hi all

    I have a sheet with which I am recording a macro to get it to turn into a sheet we need to import quickly and I have two questions that I think might be related. If anyone can help me work out how to carry this out whilst I record my macro I'd be super happy!

    Ok so the first thing I want to do is if there is any text in column A how do I record a macro to add 'Category Details' in Column F (under the main heading row)

    Secondly how do I do the same kind of thing, searching column A but this time for specific text. If the cell contains the word 'Salary' (can be around other words but Salary is a constant) in column G the word 'Bank Operating' Gets populated.

    The issue I have is that the sheet will vary in length so wondered how to achieve this. Not sure if you need a spreadsheet to work with for this but attached one anyhow made of dummy data.


    Much appreciate the help
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    03-24-2020
    Location
    Thailand
    MS-Off Ver
    Office 2016
    Posts
    897

    Re: Help adding text to a column during a marco recording

    Hi there,

    Assuming your 'Category details' refer the the first part of the value in column A (after the 4 digit number to the column ':').

    Try this code:

    Please Login or Register  to view this content.
    If your Question is answered; please mark it SOLVED. If you are happy with a member's solution, say 'Thanks' and click the 'Star' to Add Reputation.

  3. #3
    Registered User
    Join Date
    02-04-2013
    Location
    London, England
    MS-Off Ver
    Excel 2011, mac
    Posts
    45

    Re: Help adding text to a column during a marco recording

    Wow thanks so much for the time you spent on this. This is nearly perfect. The one thing though is that I actually want 'Category Details' written in column F regardless of whats written in column A, thats it so no need to copy any of that at all just have Category details display as long as theres something, anything at all in column A. The other macro piece looks wonderful! Any chance you can help me with that? I was wondering if maybe it would be somethign like this (after looking at your code):

    Split out the category name from column A
    If InStr(Range("A" & i), ":") > 0 Then
    Range("F" & i).Value = "Category Details"
    End If

    Also I wonder if the ":" could be replaced with a "*" to pick anything up. The ":" probably will work anyhow but what is used for any character?

    Best


    Scott
    Last edited by Ayupchap; 09-17-2021 at 05:53 PM.

  4. #4
    Valued Forum Contributor
    Join Date
    03-24-2020
    Location
    Thailand
    MS-Off Ver
    Office 2016
    Posts
    897

    Re: Help adding text to a column during a marco recording

    Hi Scott,

    Thanks for your feedback.
    Just writing 'Category Details' makes it simpler.

    Try the below.

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Recording a marco & using Ctrl+Shift+Down
    By lewys120 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-09-2019, 12:57 AM
  2. Trouble with Conditional Formatting with Marco recording
    By dmrf in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-24-2018, 05:27 PM
  3. [SOLVED] Locating text in a column, then adding numbers from the adjacent column.
    By CertainlyIndecisive in forum Excel Formulas & Functions
    Replies: 29
    Last Post: 01-02-2018, 12:54 PM
  4. [SOLVED] Code needed for adding text onto current text every three rows down a column?
    By rhendrickson11 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-06-2017, 09:11 AM
  5. Adding sequential numbers to Column A if Column B has text
    By computer12345 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-28-2015, 09:11 AM
  6. [SOLVED] Marco for pivot table like fuctions. Subtotal column C, based on column B criteria.
    By RobertOHare in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-09-2013, 02:57 PM
  7. Recording cell changes and adding rows
    By aznprod517 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-28-2009, 12:59 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1