Solved: Sheet name in formula instead of caption
Hi friends
In programming sense each object has 2 identifier
1st one is name (accessible to programmer only)
2nd one is caption ( which user see)
say u put one command button mentioning click me
so command1 will be name & click me will be caption
same way in excel sheet name june
so we can use
[VBA]sheet1.select
or
sheets("June").select[/VBA]
the difference is if we use 2nd code our macro throws error if someone changes name of sheet june to july or whatever
but if we use first line then irrespective of sheet name our code will work
if u are clear than i start with my problem (the above explanation was to differenctiate name & caption property)
now can the same differentitaion can be applicable in vba formula
like my recorded macro line is
[VBA]
Sheets("Summ").Select
Range("R2").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[-17],Deliveries!C1:C17,10,0)"[/VBA]
now in above code I want modification as
[VBA]
' the below lines makes me tension free now user can change name
Sheet1.select' Sheets("Summ").Select
Range("R2").Select
' now pl tell me code for the below line as if user changes sheet name Deliveries than my macro gets stuck over that
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[-17],Deliveries!C1:C17,10,0)"[/VBA]
there is any way by which i can substitute Sheet Caption Deliveries with its programming code like sheet3
so that user change the name from deliveries to say XYZ but my code will run properly
Error if Project is Locked
Hi I made the changes in my project & it worked perfectly.
when I put the VBA Project password to hide coding execution gives me error
Run-Time error '50289'
Can't perform operation since the project is protected
error comes in this line
[VBA]Dim Shtnm21, shtnm26, shtnm25 As String
With ActiveWorkbook.VBProject
Shtnm21 = CStr(.VBComponents("Sheet21").Properties("Name")) 'Declared as Dividend
shtnm26 = CStr(.VBComponents("Sheet26").Properties("Name")) 'Delcared as PreBhav-Fut
shtnm25 = CStr(.VBComponents("Sheet25").Properties("Name")) 'Delcared as CurBhav-Fut
End With[/VBA]
if I am taking through XLD given code it works perfectly in open source code project. but the moment I lock the project it gives error
so there is any code which unlock my VBA project & then lock it after completion of code.
I am having code its my own working (means I am not asking for code breaking)
pl help