I have to get value of a dynamical macro where the index is given by \ref{mymarker}. Is it possible to do? I define a set of macros with a predefined counter 'mycounter' as
\expandafter\newcommand\csname mymacro\the\value{mycounter} \endcsname{mytext}
where 'mytext' depends on the value of counter.
After that I define a new command
\newcommand{\anotherref}[1]{\csname mymacro\ref{#1} \endcsname}
the code like
\anotherref{mymarker}
does not work. The idea is that this command should give not the counter value related to 'mymarker', like \ref{mymarker} gives, but rather the text 'mytext', which is also related to 'mymarker'.

refcountand\getrefnumber– egreg Sep 20 '12 at 12:10mymarkeris undefined? How should\anotherrefbehave, if the macro to be used is not defined? Also you have a space at the end of the macro name (on purpose or accidentally). – Heiko Oberdiek Sep 20 '12 at 12:49