Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Last cell touched on sheet

What can I do to have the last cell touched on the sheet saved using code?
The code below does not retain B37 as the last cell even though this code is
right at the end before saving the workbook. Instead the last cell touched is
retained as the last one the user clicked on ... which is very annoying and
messy looking. Thanks.

excel.Range rg37 = null;
rg37.get_Range("B37", "B37");
rg37.Font.ColorIndex =
clsStatic.ColorCodes.white;
rg37.Value2 = dtRunDate.ToShortDateString();
rg37.Select();

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,549
Default Last cell touched on sheet

What programming language are you using?
What version of Excel are you using?
Where is the code located?
--
Jim Cone
Portland, Oregon USA



"cupboy"
wrote in message
What can I do to have the last cell touched on the sheet saved using code?
The code below does not retain B37 as the last cell even though this code is
right at the end before saving the workbook. Instead the last cell touched is
retained as the last one the user clicked on ... which is very annoying and
messy looking. Thanks.

excel.Range rg37 = null;
rg37.get_Range("B37", "B37");
rg37.Font.ColorIndex = clsStatic.ColorCodes.white;
rg37.Value2 = dtRunDate.ToShortDateString();
rg37.Select();
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Last cell touched on sheet

It's Visual C# and excel object library 11. Code is located in Utah.
It fails on the Select() but gives no useful info. I've also tried Activate().
Just give me VBA code and I'll convert it over to what I use.

"Jim Cone" wrote:

What programming language are you using?
What version of Excel are you using?
Where is the code located?
--
Jim Cone
Portland, Oregon USA



"cupboy"
wrote in message
What can I do to have the last cell touched on the sheet saved using code?
The code below does not retain B37 as the last cell even though this code is
right at the end before saving the workbook. Instead the last cell touched is
retained as the last one the user clicked on ... which is very annoying and
messy looking. Thanks.

excel.Range rg37 = null;
rg37.get_Range("B37", "B37");
rg37.Font.ColorIndex = clsStatic.ColorCodes.white;
rg37.Value2 = dtRunDate.ToShortDateString();
rg37.Select();

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Last cell touched on sheet

Just give me VBA code and I'll convert it over to what I use.

Why not give us the VBA code that fails, if necessary with any other steps
required to replicate.

Regards,
Peter T

"cupboy" wrote in message
...
It's Visual C# and excel object library 11. Code is located in Utah.
It fails on the Select() but gives no useful info. I've also tried
Activate().
Just give me VBA code and I'll convert it over to what I use.

"Jim Cone" wrote:

What programming language are you using?
What version of Excel are you using?
Where is the code located?
--
Jim Cone
Portland, Oregon USA



"cupboy"
wrote in message
What can I do to have the last cell touched on the sheet saved using
code?
The code below does not retain B37 as the last cell even though this code
is
right at the end before saving the workbook. Instead the last cell
touched is
retained as the last one the user clicked on ... which is very annoying
and
messy looking. Thanks.

excel.Range rg37 = null;
rg37.get_Range("B37", "B37");
rg37.Font.ColorIndex = clsStatic.ColorCodes.white;
rg37.Value2 = dtRunDate.ToShortDateString();
rg37.Select();



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Last cell touched on sheet

Here is the corrected code. I had to Activate the sheet first, before I could
do the Select. That's all that was wrong with it.

excel.Range rg37 = w.get_Range("B37", "B37");
rg37.Font.ColorIndex = clsStatic.ColorCodes.white;
rg37.Value2 = dtRunDate.ToShortDateString();
w.Activate();
rg37.Select(); // 'Can't select unless the sheet
is active
// refer to
http://msdn.microsoft.com/en-us/library/bb178282.aspx


"Peter T" wrote:

Just give me VBA code and I'll convert it over to what I use.


Why not give us the VBA code that fails, if necessary with any other steps
required to replicate.

Regards,
Peter T

"cupboy" wrote in message
...
It's Visual C# and excel object library 11. Code is located in Utah.
It fails on the Select() but gives no useful info. I've also tried
Activate().
Just give me VBA code and I'll convert it over to what I use.

"Jim Cone" wrote:

What programming language are you using?
What version of Excel are you using?
Where is the code located?
--
Jim Cone
Portland, Oregon USA



"cupboy"
wrote in message
What can I do to have the last cell touched on the sheet saved using
code?
The code below does not retain B37 as the last cell even though this code
is
right at the end before saving the workbook. Instead the last cell
touched is
retained as the last one the user clicked on ... which is very annoying
and
messy looking. Thanks.

excel.Range rg37 = null;
rg37.get_Range("B37", "B37");
rg37.Font.ColorIndex = clsStatic.ColorCodes.white;
rg37.Value2 = dtRunDate.ToShortDateString();
rg37.Select();






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Last cell touched on sheet

You might want to activate the workbook too, just in case.

Regards,
Peter T

"cupboy" wrote in message
...
Here is the corrected code. I had to Activate the sheet first, before I
could
do the Select. That's all that was wrong with it.

excel.Range rg37 = w.get_Range("B37", "B37");
rg37.Font.ColorIndex =
clsStatic.ColorCodes.white;
rg37.Value2 = dtRunDate.ToShortDateString();
w.Activate();
rg37.Select(); // 'Can't select unless the
sheet
is active
// refer to
http://msdn.microsoft.com/en-us/library/bb178282.aspx


"Peter T" wrote:

Just give me VBA code and I'll convert it over to what I use.


Why not give us the VBA code that fails, if necessary with any other
steps
required to replicate.

Regards,
Peter T

"cupboy" wrote in message
...
It's Visual C# and excel object library 11. Code is located in Utah.
It fails on the Select() but gives no useful info. I've also tried
Activate().
Just give me VBA code and I'll convert it over to what I use.

"Jim Cone" wrote:

What programming language are you using?
What version of Excel are you using?
Where is the code located?
--
Jim Cone
Portland, Oregon USA



"cupboy"
wrote in message
What can I do to have the last cell touched on the sheet saved using
code?
The code below does not retain B37 as the last cell even though this
code
is
right at the end before saving the workbook. Instead the last cell
touched is
retained as the last one the user clicked on ... which is very
annoying
and
messy looking. Thanks.

excel.Range rg37 = null;
rg37.get_Range("B37", "B37");
rg37.Font.ColorIndex = clsStatic.ColorCodes.white;
rg37.Value2 = dtRunDate.ToShortDateString();
rg37.Select();






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
How do I copying data from a cell on sheet to a diff cell/sheet Bowldiva120 Excel Worksheet Functions 1 March 21st 10 11:25 PM
copy a sum in cell on sheet 1 (not formula) to cell on sheet 2 John Excel Worksheet Functions 1 March 2nd 09 12:01 AM
copy a sum in cell on sheet 1 (not formula) to cell on sheet 2 Eduardo Excel Worksheet Functions 0 February 27th 09 05:19 PM
Next time sheet is touched, remove items from cells? Don Excel Discussion (Misc queries) 2 August 15th 08 07:03 PM
Excell:Move from any Cell Sheet 1 to any cell Sheet 2 etc. eldo Excel Worksheet Functions 1 August 16th 05 09:17 AM


All times are GMT +1. The time now is 04:45 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"