Consulting

Results 1 to 10 of 10

Thread: Find Cut and Paste at bottom

  1. #1
    VBAX Expert
    Joined
    Apr 2007
    Location
    Orlando, FL
    Posts
    751
    Location

    Find Cut and Paste at bottom

    I wanted to see if i can have someone enter a number in a input box i put on a spreadsheet that then would look at one column for that number if found to grab all that match and move to the next available line and move everything else up. And If possible I want to be able to call a macro after that that runs on another worksheet.

  2. #2
    VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    Quote Originally Posted by Emoncada
    I wanted to see if i can have someone enter a number in a input box i put on a spreadsheet that then would look at one column for that number if found to grab all that match and move to the next available line and move everything else up. And If possible I want to be able to call a macro after that that runs on another worksheet.
    Hi Em,
    If the number is found grab all of what that match.. the row?
    Move to the next line? You mean at the bottom or to another sheet?
    You answered your own question about calling a macro....use call

    [VBA]call yourmacro[/VBA]
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  3. #3
    VBAX Expert
    Joined
    Apr 2007
    Location
    Orlando, FL
    Posts
    751
    Location
    Basically if the order number is found in 3 rows i want it to grab those 3 rows and move them to the bottem of the same sheet.
    Example
    If order number is found in column A in row 5,6,7, & 8 then I want it to grab rows 5:8 cut and paste on the bottom on the sheet underneath the last line so if the last row is 28 i want it to go into row 29,30,31 & 32, but then i don't want rows 5:8 empty so i would like to move everything up.

    And the call is a little more difficult than that. The macro runs when you double click in a cell on sheet2, but i want to be to have it double click it depending on the number entered in the first part. So if the number is "12345" then it will look for "12345" on sheet1 grab it move to bottom and then look for "12345" on sheet2 then when found have it double click it. Which then opens a form. I know that a lot any help would be great.

  4. #4
    VBAX Expert
    Joined
    Apr 2007
    Location
    Orlando, FL
    Posts
    751
    Location
    Let me explain my situation. I have a form that I need to be able to call back after it's sent to the spreadsheet. So i was trying to see if i can get some help on how to do that with no luck. I did have code on doing it but just with all the data in the same row. So what I did was created another worksheet that takes all the data and put's it all in one row, while still keeping the data on the original worksheet the way i want it.

    So now I am able to call the userform back with all the information i need. So I hide the new worksheet with all the data in one row, and would like to be able to call it through the first original sheet. That is why I am trying this, this way. It's the only way I can figure it can work.

    I can attach spreadsheet if needed.

  5. #5
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Quote Originally Posted by Emoncada
    I can attach spreadsheet if needed.
    I think that would be a help. It saves us having to replicate your workbook.
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  6. #6
    VBAX Expert
    Joined
    Apr 2007
    Location
    Orlando, FL
    Posts
    751
    Location
    Sorry i should of just added it. Hope this helps.

  7. #7
    VBAX Expert
    Joined
    Apr 2007
    Location
    Orlando, FL
    Posts
    751
    Location
    Is this possible?

  8. #8
    Administrator
    VP-Knowledge Base VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    There must be a better way of getting the value fron the dropdown!
    The move can be accomplished with
    [vba]Sub MoveRows()
    Dim Rng As Range, c As Range, FirstAddress As String
    Dim Num As Long
    Num = Range("A1").Offset(ActiveSheet.DropDowns(1))
    With Columns(1)
    Set c = .Find(Num, LookIn:=xlValues)
    If Not c Is Nothing Then
    FirstAddress = c.Address
    Do
    If Rng Is Nothing Then
    Set Rng = c
    Else
    Set Rng = Union(Rng, c)
    End If
    Set c = .FindNext(c)
    Loop While Not c Is Nothing And c.Address <> FirstAddress
    End If
    End With
    Rng.EntireRow.Copy Cells(Rows.Count, 1).End(xlUp).Offset(1)
    Rng.EntireRow.Delete
    End Sub

    [/vba]
    Last edited by mdmackillop; 05-25-2007 at 02:32 PM. Reason: Code revised
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  9. #9
    VBAX Expert
    Joined
    Apr 2007
    Location
    Orlando, FL
    Posts
    751
    Location
    Basically I setup the combobox on the spreadsheet to pull all in column A. I would of liked just to have the user double click the order like I have in the second worksheet but it seems that isn't possible. So that's when I came up with the idea if they select the one to edit then somehow run the macro to have the second worksheet open up the form depending on what was selected in the combobox. The reason I wanted for this to delete the original is because if there is a change like they add a new item, I don't want it to affect another order. Possible overwrite an updated order. I know this is a little complex but I have seen some amazing stuff from this forum so I hope someone will give it a try.

  10. #10
    VBAX Expert
    Joined
    Apr 2007
    Location
    Orlando, FL
    Posts
    751
    Location
    MdMack do you recommend some other way of doing what I am trying to do a different way?

Posting Permissions

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