Go To line of code in VBE?

  • Thread starter Thread starter Rob Lerner
  • Start date Start date
R

Rob Lerner

Jumping from module to module, I want to go to a specific line number of
code within each module. A sort of "Go To" tool would be nice. Is there such
a puppy in the VBE for doing this?

Thanks.

Rob
 
Hi
sub foo()

if activecell.value = "a" then goto a_label

' some code

a_label:
'some other code
end sub
 
Hi Rob,
Jumping from module to module, I want to go to a specific line number of
code within each module. A sort of "Go To" tool would be nice. Is there such
a puppy in the VBE for doing this?

What would you like to do:

- Based on a condition jump to that line and continue the program

Frank Kabel gave you a sample to do that

- press a key and be taken to that line so you can view it in the editor

You could add a (unique) comment on a position you would like to be able to
return to and then later on press Find in the VBE and enter text inside that
comment.

If your workbook is a normal visible workbook, whilst in Excel you can use F5
(goto) to goto a specific module, simply type its name and hit OK.

Regards,

Jan Karel Pieterse
Excel MVP
www.jkp-ads.com
 
Jan Karel Pieterse said:
Hi Rob,


What would you like to do:

- Based on a condition jump to that line and continue the program

Frank Kabel gave you a sample to do that

- press a key and be taken to that line so you can view it in the editor

You could add a (unique) comment on a position you would like to be able to
return to and then later on press Find in the VBE and enter text inside that
comment.

If your workbook is a normal visible workbook, whilst in Excel you can use F5
(goto) to goto a specific module, simply type its name and hit OK.

Regards,

Jan Karel Pieterse
Excel MVP
www.jkp-ads.com

Thanks, Jan. Example: I'm already in the VBE and in the module looking at my
code. I know the line number I want to get to (line 437). Does that help?

-Rob
 
Hi Rob,
Thanks, Jan. Example: I'm already in the VBE and in the module looking at my
code. I know the line number I want to get to (line 437). Does that help?

Sorry, I know no way to do that using normal methods.

Regards,

Jan Karel Pieterse
Excel MVP
www.jkp-ads.com
 
Jan Karel Pieterse said:
Hi Rob,


Sorry, I know no way to do that using normal methods.

Regards,

Jan Karel Pieterse
Excel MVP
www.jkp-ads.com

Thanks Jan for the confirmation. I just wanted to be sure I wasn't missing
anything.

I do use comments quite a bit and it helps to jump around in a module using
the Find command. But sometimes I edit code in one module of a file and have
to do the same edit for the exact same module in another file (same module
name too). So I note the line number in one and head there in the other.

Hey, I just had a thought. I could just export the edited module into the
other file(s), couldn't I? Is that a normal practice when fixing one module
that several other files also have? What's the fastest steps to do that?

-Rob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top