Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Save Cell address to activate it later in the procedure

I am writing a procedure where i am standing in a cell.
Thereafter i shall automatically in the prosedure change the width of column
D-E from 20 to 40.

Afterwards i want the same cell to be active as it was before i started the
procedure.

I am using relative reference in the procedure.

Can someone please help me with how i save an cell adrress for reuse later?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 84
Default Save Cell address to activate it later in the procedure

So, if I understand you code, you want to call a sub routine that takes care
of the column width piece then when it pops back to where you called the
procedure, you would like it to go back to the cell you started on. If
that's the case, simply do one one of the following:

(A) Create a string variable in the calling procedure and pass it the
address of the activecell.

(B) Create a Range variable and in the calling procedure pass it the
activecell.

Following your procedure call use the RANGE command to select your
variable's range.


"loco" wrote:

I am writing a procedure where i am standing in a cell.
Thereafter i shall automatically in the prosedure change the width of column
D-E from 20 to 40.

Afterwards i want the same cell to be active as it was before i started the
procedure.

I am using relative reference in the procedure.

Can someone please help me with how i save an cell adrress for reuse later?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Save Cell address to activate it later in the procedure

You do NOT have to goto columns d:e to set the column width
Sub widencolumn()
Columns("d:e").ColumnWidth = 40
End Sub

But, to answer your question
Sub goback()
returncell = ActiveCell.Address
Range("a33").Select
MsgBox ActiveCell.Address
Range(returncell).Select
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"loco" wrote in message
...
I am writing a procedure where i am standing in a cell.
Thereafter i shall automatically in the prosedure change the width of
column
D-E from 20 to 40.

Afterwards i want the same cell to be active as it was before i started
the
procedure.

I am using relative reference in the procedure.

Can someone please help me with how i save an cell adrress for reuse
later?


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Save Cell address to activate it later in the procedure

Thank you very much.
I could copy your code suggestion directly into my VB-code and it did run OK
at once.

Loco

Don Guillett skrev:

You do NOT have to goto columns d:e to set the column width
Sub widencolumn()
Columns("d:e").ColumnWidth = 40
End Sub

But, to answer your question
Sub goback()
returncell = ActiveCell.Address
Range("a33").Select
MsgBox ActiveCell.Address
Range(returncell).Select
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"loco" wrote in message
...
I am writing a procedure where i am standing in a cell.
Thereafter i shall automatically in the prosedure change the width of
column
D-E from 20 to 40.

Afterwards i want the same cell to be active as it was before i started
the
procedure.

I am using relative reference in the procedure.

Can someone please help me with how i save an cell adrress for reuse
later?



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Event Procedure (re-activate automatic calulation if disabled) Edmund Excel Programming 1 June 30th 06 04:31 AM
Error 1004 from worksheet activate procedure mikeburg[_9_] Excel Programming 1 July 14th 05 01:25 AM
selection.find shortening the procedure by skipping the "activate" part Peter[_21_] Excel Programming 1 November 10th 04 11:56 PM
How to Activate procedure with parameters ivarsb Excel Programming 3 July 27th 04 10:42 AM


All times are GMT +1. The time now is 11:51 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"