+ Reply to Thread
Results 1 to 9 of 9

Have question about using .find statement and brackets around After:= statement

  1. #1
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,596

    Have question about using .find statement and brackets around After:= statement

    I am reviewing some code and i found this .find statement.

    Please Login or Register  to view this content.

    I am confused about the following:

    After:=[Study_col_Header1]


    whats up with the "[]" brackets?

  2. #2
    Valued Forum Contributor MaczaQ's Avatar
    Join Date
    06-03-2011
    Location
    Poland
    MS-Off Ver
    Excel 2003 / XP
    Posts
    510

    Re: Have question about using .find statement and brackets around After:= statement

    i think it is only comment.
    Whole part After:= .... can be remove if you do not need to start search from some range

    it could be After:=Range("a1") too etc.

    BR
    MaczaQ

  3. #3
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,596

    Re: Have question about using .find statement and brackets around After:= statement

    i am not sure i understand.

    I think search does need to start from some range..........

    I have used the After:=.cells(1,1) type declaration to define the start but i dont know what the After:=[Study_col_Header1] is doing? The study_col_header1 is just an integer its not a cell location........as far as i know.

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,167

    Re: Have question about using .find statement and brackets around After:= statement

    It's a named range.
    Cheers
    Andy
    www.andypope.info

  5. #5
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,596

    Re: Have question about using .find statement and brackets around After:= statement

    your correct........its a defined range where

    Set Study_col_Header1 = ws.Cells(hdr_row_number, stdy_col_number + 1)


    But why the brackets? What is there purpose?

  6. #6
    Valued Forum Contributor MaczaQ's Avatar
    Join Date
    06-03-2011
    Location
    Poland
    MS-Off Ver
    Excel 2003 / XP
    Posts
    510

    Re: Have question about using .find statement and brackets around After:= statement

    I think it was only comment where that range should be type. But it is only my idea. Probable oryginal author have some reason

    Best Regards
    MaczaQ

  7. #7
    Forum Guru jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Have question about using .find statement and brackets around After:= statement

    Hi welchs101

    The use of brackets is a shorthand method for referencing of a range. This
    Please Login or Register  to view this content.
    is the same as this
    Please Login or Register  to view this content.
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  8. #8
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Have question about using .find statement and brackets around After:= statement

    Hello John,

    While both methods produce the same final result, the brackets invoke the Excel application to interpret (parse) the data between the brackets. While this method is shorter than using the standard Range method, it also incurs more processing time. There are times when the brackets can be very useful, but for the most part you should use the native VBA methods.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  9. #9
    Forum Guru jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Have question about using .find statement and brackets around After:= statement

    Hi Leith

    Always happy to read your insightful comments. For me, personally, I have too many issues with longhand let alone shorthand. I've not used shorthand...makes things too confusing and, in my opinion, much harder to read.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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