Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default get_End question

Hello,

I'm using the get_End function for finding a row of used cells (using VSTO
3.0 and C#). My code works fine if there are two or more cells next to each
other with something in them, but if only the first cell has something in it,
then I get the whole row. Is that expected behaviour for get_End, or am I
doing something wrong?

My code:
Range first_cell = Globals.SheetBuyerHistory.Cells.get_Item(row_numbe r, 1)
as Range;
Range last_cell = first_cell.get_End(XlDirection.xlToRight);
Range used_row = Globals.SheetBuyerHistory.Range[first_cell, last_cell] as
Range;

Cheers,

Ollie

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default get_End question

use column count to get the last colun then use End(xltoleft)
this will get the last column used in that row



"Ollie Purkiss" wrote:

Hello,

I'm using the get_End function for finding a row of used cells (using VSTO
3.0 and C#). My code works fine if there are two or more cells next to each
other with something in them, but if only the first cell has something in it,
then I get the whole row. Is that expected behaviour for get_End, or am I
doing something wrong?

My code:
Range first_cell = Globals.SheetBuyerHistory.Cells.get_Item(row_numbe r, 1)
as Range;
Range last_cell = first_cell.get_End(XlDirection.xlToRight);
Range used_row = Globals.SheetBuyerHistory.Range[first_cell, last_cell] as
Range;

Cheers,

Ollie

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
Excel 2007 Macro/VB Question DDE Question MadDog22 Excel Worksheet Functions 1 March 10th 10 01:47 AM
Good morning or good evening depending upon your location. I want to ask you the most important question of your life. Your joy or sorrow for all eternity depends upon your answer. The question is: Are you saved? It is not a question of how good davegb Excel Programming 1 May 6th 05 06:35 PM
Good morning or good evening depending upon your location. I want to ask you the most important question of your life. Your joy or sorrow for all eternity depends upon your answer. The question is: Are you saved? It is not a question of how good you [email protected] Excel Programming 0 April 27th 05 07:46 PM
Good morning or good evening depending upon your location. I want to ask you the most important question of your life. Your joy or sorrow for all eternity depends upon your answer. The question is: Are you saved? It is not a question of how good you [email protected] Excel Programming 23 April 23rd 05 09:26 PM
Good morning or good evening depending upon your location. I want to ask you the most important question of your life. Your joy or sorrow for all eternity depends upon your answer. The question is: Are you saved? It is not a question of how good you [email protected] Excel Programming 0 April 22nd 05 03:30 PM


All times are GMT +1. The time now is 05:47 PM.

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

About Us

"It's about Microsoft Excel"