Results 1 to 9 of 9

Change code to search amount.

Threaded View

  1. #1
    Forum Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Change code to search amount.

    HI I have below code which search in column J for the amount. and when find it copy the rows to sheet 3, which have this amount.
    I need 2 changes.
    First i need to when i search and it copy to sheet 3. If i search again for other amount. i need it to not overwrite the all ready found rows but continue in the next blank row
    in sheet 3.

    The next i need is a change in the amount of rows. Its like this code can only work with the 65536 rows even if the workbook is saved as a xlsm in excel 2013.
    I need the range to be made so it can search in big sheets. This line i need to be changed

    #lastline = Range("A65536").End(xlUp).Row#




    Here is the full code. Please have a look.

    Sincerely

    Abjac

    P.s i cant put anything around the code. Like the option is not there i tried put manually in, but its not working the option to make bold and the other is not there now.

    #Sub customcopy()
    Sheets(2).Activate
    Dim strsearch As String, lastline As Integer, tocopy As Integer
    linestart:
    strsearch = CStr(InputBox("enter the amount to search for"))
    lastline = Range("A65536").End(xlUp).Row
    j = 2
    For i = 1 To lastline
    ' Can search in more than one column. Change the range example A instead of J and second J,
    ' will search in column A to J then below example only in column J
    For Each c In Range("J" & i & ":J" & i)
    If InStr(c.Text, strsearch) Then
    tocopy = 1
    End If
    Next c
    If tocopy = 1 Then
    Rows(i).Copy Destination:=Sheets(3).Rows(j)
    j = j + 1
    ffound = ffound + 1
    End If

    tocopy = 0

    Next i
    If ffound = 0 Then
    MsgBox "Not found, Try again"
    GoTo linestart
    End If
    End Sub#
    Last edited by abjac; 05-30-2016 at 06:12 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. VBA Code - Search text & search number & search qty and result - Urgent Please
    By naresh73 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-15-2014, 10:51 AM
  2. Sum charge amount every time the code and the order number change
    By children in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-19-2013, 08:49 AM
  3. Create Search in column E for amount.Patel 45 your original code
    By abjac in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 11-28-2012, 03:51 PM
  4. search change code
    By qwzx in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-19-2011, 05:19 AM
  5. Replies: 6
    Last Post: 05-11-2011, 04:40 PM
  6. Search data for largest amount
    By maacmaac in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-17-2009, 06:05 PM
  7. Sumproduct formula:Empl Code Payroll Code Amount
    By bluemeg in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-30-2009, 02:08 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