+ Reply to Thread
Results 1 to 6 of 6

Auto moving a row when a text value is in a certain cell

  1. #1
    Registered User
    Join Date
    12-08-2023
    Location
    UK
    MS-Off Ver
    Newest
    Posts
    3

    Auto moving a row when a text value is in a certain cell

    Hello,

    I am currently creating a spreadsheet for following up on leads.

    I have a main data file that feeds into a spreadsheet. I need to be able to move 3 different text values to different tabs.

    Column B will have; Won, Lost, Cancelled and based on these I need to move those 3 separate rows to 3 separate tabs, currently I can only move one without messing the code.

    Capture.PNG

    Thank you.

  2. #2
    Registered User
    Join Date
    12-08-2023
    Location
    UK
    MS-Off Ver
    Newest
    Posts
    3

    Re: Auto moving a row when a text value is in a certain cell

    I got this from a webiste;

    Sub MoveBasedOnValue()

    'Created by Excel 10 Tutorial

    Dim xRg As Range

    Dim xCell As Range

    Dim A As Long

    Dim B As Long

    Dim C As Long

    A = Worksheets("LNGF All").UsedRange.Rows.Count

    B = Worksheets("Won Job").UsedRange.Rows.Count

    If B = 1 Then

    If Application.WorksheetFunction.CountA(Worksheets("Won Job").UsedRange) = 0 Then B = 0

    End If

    Set xRg = Worksheets("LNGF All").Range("B1:B" & A)

    On Error Resume Next

    Application.ScreenUpdating = False

    For C = 1 To xRg.Count

    If CStr(xRg(C).Value) = "Won" Then

    xRg(C).EntireRow.Copy Destination:=Worksheets("Won Job").Range("A" & B + 1)

    xRg(C).EntireRow.Delete

    If CStr(xRg(C).Value) = "Won" Then

    C = C - 1

    End If

    B = B + 1

    End If

    and this too,

    Private Sub Worksheet_Change(ByVal Target As Range)

    'Subscribe to youtube.com/excel10tutorial

    Dim Z As Long

    Dim xVal As String

    On Error Resume Next

    If Intersect(Target, Range("B:B")) Is Nothing Then Exit Sub

    Application.EnableEvents = False

    For Z = 1 To Target.Count

    If Target(Z).Value > 0 Then

    Call MoveBasedOnValue

    End If

    Next

    Application.EnableEvents = True

    End Sub

  3. #3
    Forum Contributor
    Join Date
    11-23-2022
    Location
    Amsterdam
    MS-Off Ver
    2021
    Posts
    193

    Re: Auto moving a row when a text value is in a certain cell

    Please post the excel file.

  4. #4
    Registered User
    Join Date
    12-08-2023
    Location
    UK
    MS-Off Ver
    Newest
    Posts
    3

    Re: Auto moving a row when a text value is in a certain cell

    I cant as it contains sensitive information. :/

  5. #5
    Forum Contributor
    Join Date
    11-23-2022
    Location
    Amsterdam
    MS-Off Ver
    2021
    Posts
    193

    Re: Auto moving a row when a text value is in a certain cell

    OK. Then I guess there is nothing I can do.

  6. #6
    Valued Forum Contributor
    Join Date
    08-31-2007
    Location
    SW Ireland
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2311 Build 16.0.17029.20068) 32-bit
    Posts
    523

    Re: Auto moving a row when a text value is in a certain cell

    If you could upload a non-confidential mock-up and show 'before and after' together with any extra text descriptions so that readers fully understand the task you'd have a much better chance of getting assistance.
    Excel 365 user. To unblock a downloaded macro-enabled workbook, go to your "Downloads" folder > right click on the workbook name > click 'Properties' > check the 'Unblock' checkbox. You can now open the workbook.

+ 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] Moving text within a cell
    By Chanty in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-14-2021, 08:26 AM
  2. [SOLVED] Moving Text from One cell to another if it matches some set text
    By andylpsx in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-24-2014, 01:23 PM
  3. Moving part of text in cell to another cell Excel 2007
    By Deepesh in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 05-22-2013, 06:25 AM
  4. Auto-Converting Cell Value to link & moving rows of data based on cell value
    By Th3Forgotten in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-15-2013, 08:05 AM
  5. Replies: 2
    Last Post: 11-29-2012, 11:27 AM
  6. Moving text from one cell to another
    By Firefighter_930 in forum Excel General
    Replies: 14
    Last Post: 12-23-2006, 05:21 AM
  7. [SOLVED] HOW TO KEEP TEXT FROM MOVING OUT OF A CELL?
    By Briguyy in forum Excel General
    Replies: 2
    Last Post: 02-23-2006, 05:10 PM

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