+ Reply to Thread
Results 1 to 5 of 5

Macro to insert "vacant" into a cell based on criteria in another cell

  1. #1
    Registered User
    Join Date
    09-04-2014
    Location
    madison, ms
    MS-Off Ver
    365
    Posts
    15

    Macro to insert "vacant" into a cell based on criteria in another cell

    First post and very green when in comes to Macros.

    I have a spreadsheet with multiple columns. Column 4 is Tenant Name and Column 6 is a Notes field.

    If column 6 says "Vacant" I want the Vacant to show in Column 4.

    After putting "Vacant" in column 4 I want to delete columns 6,7 and 8.

    Any help would be greatly appreciated.

    Thanks,
    Barry

  2. #2
    Forum Contributor lancer102rus's Avatar
    Join Date
    04-02-2014
    Location
    Ufa
    MS-Off Ver
    Excel 2010, 2013
    Posts
    252

    Re: Macro to insert "vacant" into a cell based on criteria in another cell

    Do you really want to delete columns? Or you need to clear cells in columns 6,7,8?

  3. #3
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Macro to insert "vacant" into a cell based on criteria in another cell

    Maybe:

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    09-04-2014
    Location
    madison, ms
    MS-Off Ver
    365
    Posts
    15

    Re: Macro to insert "vacant" into a cell based on criteria in another cell

    Quote Originally Posted by JOHN H. DAVIS View Post
    Maybe:

    Please Login or Register  to view this content.
    Thank you very much..with a slight tweek it works perfectly. I had my column numbers off in my initial post.

    Sub switchblade13()
    Dim rcell As Range
    Dim x As Long
    x = Range("H" & Rows.Count).End(3).Row
    For Each rcell In Range(Cells(2, 8), Cells(x, 8))
    If rcell.Value = "VACANT" Then
    rcell.Offset(, -3).Value = "VACANT"
    Range(Cells(rcell.Row, 8), Cells(rcell.Row, 10)).ClearContents
    End If
    Next rcell
    End Sub

  5. #5
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Macro to insert "vacant" into a cell based on criteria in another cell

    You're welcome. Glad to help out and thanks for the feedback. In the future when posting code please use code tags - See Forum Rule No. 3 posted below. If you consider this thread as solved then please mark it as solved - See Forum Rule No. 9 posted below.

    3. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the [#] button at the top of the post window (if you are editing an existing post, press Go Advanced to see the [#] button). The result will appear like this in the post window:

    Please Login or Register  to view this content.
    ... and appear like this when posted:

    [Select Code] copy to clipboard

    your code here ...
    and here ...
    and here

    You can also type the code tags in manually if you prefer. For more information about these and other tags, click here.


    9. Acknowledge the responses you receive, good or bad. If your problem is solved, please say so clearly, and mark your thread as Solved: Click Thread Tools above your first post, select "Mark your thread as Solved". Or click the Edit button on your first post in the thread, Click Go Advanced, select [SOLVED] from the Prefix dropdown, then click Save Changes. If more than two days have elapsed, the Dropdown option or Edit button will not appear -- ask a moderator to mark it.

+ 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. [SOLVED] Insert "N/A" into a certain cell based on another cells input
    By alexander.small in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-06-2014, 05:20 AM
  2. VBA to insert pictures to " insert comment " or "Text box" in cell E5 and E15
    By Rocky2013 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-20-2013, 08:10 PM
  3. Display data in cell "N" times based off of multiple criteria
    By ronalgreen in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-05-2013, 10:02 AM
  4. Change "Parent" cell based on results of multiple "Children" cells
    By ccowman in forum Excel Formulas & Functions
    Replies: 16
    Last Post: 12-14-2012, 02:33 AM
  5. How HardDisk neme "N" or "?" (as cell value) insert into macro formula?
    By frenic in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-14-2008, 08:40 AM

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