![]() |
vba newbie - explanation
I am just starting to use vba w/ excel. Could someone perhaps please explain
the following code: sFilename = Right(Me.Cells(i, "A").Value, Len(Me.Cells(i, "A").Value) - InStrRev(Me.Cells(i, "A").Value, "_")) i know that the functions "Right", "Len", "In Str Rev" will become the sFilename which is called elsewhere; i am befuddled by the (Me.Cells(i, "A").Value). thanks for helping me get jumpstarted. patti |
vba newbie - explanation
Me refers to the containing object, which is undoubtedly the sheet in this
case. So this code is within a sheet class module. Cells(i,"A") is just picking up the cell in column A, row i. -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "patti" wrote in message ... I am just starting to use vba w/ excel. Could someone perhaps please explain the following code: sFilename = Right(Me.Cells(i, "A").Value, Len(Me.Cells(i, "A").Value) - InStrRev(Me.Cells(i, "A").Value, "_")) i know that the functions "Right", "Len", "In Str Rev" will become the sFilename which is called elsewhere; i am befuddled by the (Me.Cells(i, "A").Value). thanks for helping me get jumpstarted. patti |
vba newbie - explanation
Me is the thing that holds the code.
In your case, I bet that this code is behind a worksheet. So me.cells(i,"A").value is the value in the cell in column A, Row i Me can be used in the ThisWorkbook module, too. In that case, it refers to the workbook that owns the code. Equivalent to ThisWorkbook. Me can be used behind a userform, too. Me.combobox1.listindex = -1 would clear combobox1 on the userform that owns the code. patti wrote: I am just starting to use vba w/ excel. Could someone perhaps please explain the following code: sFilename = Right(Me.Cells(i, "A").Value, Len(Me.Cells(i, "A").Value) - InStrRev(Me.Cells(i, "A").Value, "_")) i know that the functions "Right", "Len", "In Str Rev" will become the sFilename which is called elsewhere; i am befuddled by the (Me.Cells(i, "A").Value). thanks for helping me get jumpstarted. patti -- Dave Peterson |
vba newbie - explanation
Thanks Bob & Dave for getting me started off on the right foot!
"patti" wrote: I am just starting to use vba w/ excel. Could someone perhaps please explain the following code: sFilename = Right(Me.Cells(i, "A").Value, Len(Me.Cells(i, "A").Value) - InStrRev(Me.Cells(i, "A").Value, "_")) i know that the functions "Right", "Len", "In Str Rev" will become the sFilename which is called elsewhere; i am befuddled by the (Me.Cells(i, "A").Value). thanks for helping me get jumpstarted. patti |
All times are GMT +1. The time now is 12:00 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com