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?
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?
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
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.
It's a named range.
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?
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
Hi welchs101
The use of brackets is a shorthand method for referencing of a range. Thisis the same as this![]()
Please Login or Register to view this content.
![]()
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.
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 Starbelow the post.
3. Please mark your post [SOLVED] if it has been answered satisfactorily.
Old Scottish Proverb...
Luathaid gu deanamh maille! (Rushing causes delays!)
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.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks