VB Script XL - Range Selection

I'm new to Scripting in Excel and trying to select a Range of cells beginning 
at B13... want to End-down and then go right 23 cells and have that range 
active to print... Closest I've come is 
Range ("B13".End(xlDown)).Right 23.Activate  {I've thrown in Right 23 as I 
don't know how to include that part}... thanx in advance...
0
Utf
2/2/2010 9:59:01 PM
excel.programming 6508 articles. 2 followers. Follow

2 Replies
1409 Views

Similar Articles

[PageSpeed] 2

Try

Range("B13").End(xlDown)(1, 24).Activate

Cordially,
Chip Pearson
Microsoft MVP 1998 - 2010
Pearson Software Consulting, LLC
www.cpearson.com
[email on web site]




On Tue, 2 Feb 2010 13:59:01 -0800, Servant63
<Servant63@discussions.microsoft.com> wrote:

>I'm new to Scripting in Excel and trying to select a Range of cells beginning 
>at B13... want to End-down and then go right 23 cells and have that range 
>active to print... Closest I've come is 
>Range ("B13".End(xlDown)).Right 23.Activate  {I've thrown in Right 23 as I 
>don't know how to include that part}... thanx in advance...
0
Chip
2/2/2010 10:09:22 PM
Close :) Split the command in two, first get the last row:
Lastrow = Range(Cells(13,ColNbr),Cells(13,ColNbr)).End(xlDown).Row
Then go right:
 Cells(Lastrow,ColNbr+23).Activate


"Servant63" wrote:

> I'm new to Scripting in Excel and trying to select a Range of cells beginning 
> at B13... want to End-down and then go right 23 cells and have that range 
> active to print... Closest I've come is 
> Range ("B13".End(xlDown)).Right 23.Activate  {I've thrown in Right 23 as I 
> don't know how to include that part}... thanx in advance...
0
Utf
2/2/2010 10:54:01 PM
Reply:

Similar Artilces:

Advanced Search Criteria
Just an FYI, since there doesn't seem to be a solution posted anywhere on the web, at least that I could find. If you want to search using dynamic dates, at least in the case of finding items older than a certain relative date, such as more than 30 days old, I used the following criteria successfully in Outlook 2007: Advanced Find > Advanced (tab) > Field: Sent Condition: On or after Value: 30 days ago ...

Important Word Options to be selected in Word 2007
-- mprnair What about them? -- Suzanne S. Barnhill Microsoft MVP (Word) Words into Type Fairhope, Alabama USA http://word.mvps.org "mprnair" <mprnair@discussions.microsoft.com> wrote in message news:355F31FF-4AAB-4ED6-B326-88FA301C0EED@microsoft.com... > > -- > mprnair > ...

Sheet range reference
I have a workbook with a number of sheets, let's say named sheet01, sheet02 ......sheet10. These sheets are of the same structure and are representing some development in time. So now I would like to make a chart (or separate table) the where the X coordinate is the sheet number and the Y some cell on each of the sheets. Is this possible with a simple reference like the ranges within the same chart or do I really have to create a macro or do it by hand? Jens. Each series must reside on a single sheet. You can create a summary sheet which has something like: A1: =Sheet1!A1 A2: ...

2 criteria cells used to select which validation list to use
Greetings All: (Excel 2003) I'm trying to "clean up" various workbooks and consolidate into one workbook (probably about 75 sheets, when done). I have come to the conclusion that, for clarity of my formulas, I should have used range names. I have the Name Manager, version 3.2 from Jan Karel, which hopefully will prove to be more than a little useful. My current problem relates to the use of validation, based on info from two cells, (either/or), and requiring a result of 1 of 2 validation lists. I hope the following is clear. Cell C3: Truck Cell D3 = 0 (not applicable) or 1...

Pivot Table Data Ranges
I just upgraded to excel2000, and am finding out that keyboard shortcuts used in 97 do not exist in 2000. Does anyone know of a KEYBOARD shortcut to modify, expand and or create data ranges in the dialog box for entering the range for the pivot. I have many data 'lists' which are added to each month, and when I want to update the corresponding pivot table, I used to simply hit "shift" + "end" + "down arrow" to automatically go to the last populated cell in the list. In 2000, I either have to enter in the cell addy's manually or use the mouse...

?-Change data series range as data is entered?
I have a chart which shows a prediction curve and an actual curve. The prediction curve runs out until the end of a project. The actual curve is populated as data is entered. I will be generating a number of these charts from a datatable. I would like to plot the prediction curve for the duration of the project (easy). I would then like to plot the actual curve with only the existing data and not have the line drop to the x-axis at the end. Can I put a formula in the data series "x values" field? I hope that my description makes sense..... Thanks, Carl -- isofuncurves ---...

total of a range of times
This should be simple for some of you, but not for me. I am a runner, I have 4 ind. cells w/my split times. How do I get a total for the tallied times. I'm far from being experienced but am trying to learn..any and all help will be much appreciated. Thanks, Roger Roger To help you in your quest to "try to learn" I will direct you to Chip Pearson's site so's you can learn just about all you'll ever need for Time Calculations. http://www.cpearson.com/excel/datetime.htm#AddingTimes Gord Dibben Excel MVP On Sat, 13 Nov 2004 15:19:02 -0800, "Roger WG" &...

select distinct id with other data
Hello everybody, I have a table with such data: id name 1 Mario 1 Mario Krsnic 1 MKrsnic 1 MarioK The same Id refers to different names of the same person. how can I select distinct ID with both columns? If I use select distinct id,name then I get the above data. I would like to have only: 1,Mario(or some other variante of the name) In the result should every id appear only once. Thanks for suggestions! Mario Mario Krsnic wrote: >I have a table with such data: >id name >1 Mario >1 Mario Krsnic >1 MKrsnic >1 MarioK ...

How do I automatically plot different ranges of data in different.
I need to chart parameters that are a function of three variables in the 2002 version of Excel. I have used the x and y axis to represent 2 variables on an 'xy chart', but require an automatic method to represent the value of the third variable. I have tried the 'bubble-plot', but cannot get sufficient resolution between the data. Is their any way that I may plot the third variable in different colours/shades, that automatically changes for different ranges of the the third variable? THis might help you: http://www.peltiertech.com/Excel/Charts/format.html#CondChart &q...

How do I select which framework to use when buiding my app
Hi! I have VS 2005. I just wonder where do I select which framework to use when building my app ? I have looked at the project property but I can't find it. //Tony I found it myself. You can't select framework to use when buiding in VS 2005. This is only possible in VS2008. //Tony "Tony Johansson" <johansson.andersson@telia.com> skrev i meddelandet news:em7kzW%23tKHA.2072@TK2MSFTNGP02.phx.gbl... > Hi! > > I have VS 2005. I just wonder where do I select which framework to use > when building my app ? > I have looked at the p...

Getting the longest lengh in range of cells
I am trying to get the length of the longest cell in a range and use the array {=len(a1:a1)}. What happens is that it picks up the length of cell A1. Is there a way in a formula to determine the longest cell length in a range, or through VBA. Thanks in advance Hi Try this formula array (please amend with last row number): {=MAX(LEN(A1:A7))} HTH Cordially Pascal "Geoff" <gh@bob.com> a �crit dans le message de news:uMKoCQiSFHA.1176@TK2MSFTNGP10.phx.gbl... > I am trying to get the length of the longest cell in a range and use the > array {=len(a1:a1)}. What happen...

selection in CTreeCtrl
Hello, I have a Tree Control in my application that displays two types of items: type A and type B. I want to implement the following: 1. When user clicks on any item of type A it should be shown as selected and the previously selected item will be deselected - it is actually the default behavior. 2. When user clicks on any item of type B - nothing should happen: the previously selected item remain selected and the clicked item remains deselected. So, actually, I want that the items of type B will never highlighted with a blue band. How can do it? Thanks, Mark. -- Please ...

selecting the 2nd column of a combo box in a report?
I have a combo box that uses data from a table with the fields (setupid, physician setup, md_PIN). the bound column = 1. The physicians sign on using their name (signing_md) and PIN (signing_md_pin). thanks to advice from this website I have...If signing_md_pin.value = dlookup("md_pin". "[setup table]","[setupid] =" [signing_md] then ... in the event procedure. When I try to get the physician name on the report (signing_md) it returns the physician number (setupid) instead of the name. How do I get the 2nd column of the combo box to the report?Thank you....

Select subform's query criteria from form's unbound cbo
I want users to be able to select a name from a form's unbound combo box and that selection to automatically become the criteria for the subform's underlying query, without the parameter box for the query popping up. How do I do this? I'm new to VBA and not an Access 2003 whiz either. TIA for your help! WorkerBee wrote: > I want users to be able to select a name from a form's unbound combo > box and that selection to automatically become the criteria for the > subform's underlying query, without the parameter box for the query > popping up. How do I do t...

Select Range
Having trouble selecting several non-contiguous ranges. The spreadsheet I am working with is apprx. 300 rows by 110 columns. The sheet is subtotaled. I need to copy data and move to a summary worksheet. There is a subtotaled section entitled 'Risk'. Within this section, the only data required is Country, Customer, 3Q (orders, revenue, gross margin), and 4Q (orders, revenue, gross margin); columns B, E, AQ, AR, AS, BK, BL, and BM - respectively. The section title is in cell A162 and the data is in A163:CY200. I would prefer to select all of the data from the section at once, but ...

Iterate named range & clear contents
Excel 03 Hi all I have a bunch of named ranges (Insert > Name > Define) which I wan to iterate through, & then delete their contents. I'm trying this : For Each nm in ThisWorkbook.Names nm.ClearContents Next nm can someone please show me the correct way to do this. thanks paul For Each nm In ThisWorkbook.Names On Error Resume Next Range(nm.Name).ClearContents On Error GoTo 0 Next nm -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Paul Wagstaff" <paulwagstaff@blueyonder.co.uk> wrote in mes...

report date range
I have a report that will display data from an inventory transaction history form. There I would enter in the date and several other criteria. After doing so I filter the form to my selection and then print my report. I wanted the date range that is on the form to print on the report. I hvae done this in several other reports and never had a problem until now. I'm getting #NAME. The form is still open upon viewing the report. On the report I have a text box with the logic of: ="Report Date Between: " & [Forms]![frmInvTransactionHistory]![BegtDate] & " and &...

how to link a .txt ( .dat) as a table by VB
Hi from Meudon (France) I want to link a .txt file as a table in my acces db. How to by VB : code and reference(s) (Acces 2003) Thanks by anticipation ...

select with subquery in select clause
Hi I need to make a select from 2 tables whit this layout always with the newest datetime exchange currency. The local cuurency is Mexican Pesos Table 1 Currencies example: CurrencyID Key Description 1 USD USA Dollar 2 EUR European Euro 3 Yen Japan Yen Tabla 2 is Day exchange Currency CurrencyID Equivalent DateTime 1 12.50 2010-08-07 08:00:00 1 12.55 2010-08-07 08:10:00 1 12.49 2010-08-07 08:20:00 1 12.60 2010-08-07 08:30:00 1 12.51 2010-08-07 08:40:00 1 12.52 2010-08-07 08:50:00 1 12.48 2010-08-07 09:00:00 1 12.61 2010-08-07 09:10:00 <-- the newest xchange for USD 2...

Issue running ldf script
I have followed article 314649, preventing mangled attributes. I ran the script and the logs indicate that it has been successful in modify the attributes: CN=ms-Exch-Assistant-Name, CN=ms-Exch-LabeledURI, and CN=ms-Exch-House-Identifier to the lDAPDisplayName: msExchAssistantName, msExchLabeledURI, and msExchHouseIdentifier respectively. I ran the script numerious time and each time the log states that the modifications were successful. However, when I use ADSI edit to view these attributes under the Schema container, the attributes still shows the hypens. It was suggested that I ...

Calculating greatest number in a range
This is a little tricky to explain, but hopefully will make sense. A series of data is produced that monitors concurrent users on a system. This is returned every five minutes of every day. This is on a work book which has a month for each tab. Data typically comes in the following, simple form: Wed Nov 26 10:50:01 GMT 2008 0 Wed Nov 26 10:55:00 GMT 2008 0 Wed Nov 26 11:00:00 GMT 2008 1 Wed Nov 26 11:05:00 GMT 2008 1 Wed Nov 26 11:10:00 GMT 2008 1 Wed Nov 26 11:15:00 GMT 2008 1 Wed Nov 26 11:20:00 GMT 2008 1 Essentially, I need a way of differentiating between indivi...

How to divide a data series into different ranges?
In a report i need to divide my chart by certain ranges...suppose if i have a datea series for reports for every week.I want to display the reports older than 3 months,older than 2 months etc in a single data series by dividing the data sereis...Please help It's much easier to use multiple series. If it's anything but an XY chart, use separate worksheet columns that line up with the X values, with values where the series appears and blanks where other series appear. It's pretty much as described in my Conditional Charts page: http://peltiertech.com/Excel/Charts/ConditionalC...

Select Catagories to CC to??
Is it possible to make an Outlook default to choosing contacts from Categories instead of the Address book when you CC something?? In other words, you create an email, you click cc and can you select the recepients based on contact catagories?? and not the address book?? Not really. Clicking To: or CC: (or BCC:) will invoke the Outlook Address Book exclusively. The closest you can get to this is: You can use the "By Category" view of your Contacts Folder to send only to one category of Contacts, but those addresses will be placed in the To: field, not the CC: field. You ca...

Asking Excel Solver to use binaries, but selects other values
I am trying to get a linear program solved using solver. The values that Solver needs to enter are contrained as binary, but excel still try to find values that are neither 0 or 1. Stephane, I assume that when you say it is selecting values that are neither 0 or 1, they are values that are numerically close to 0 or 1 (such as 0.99998). If this is the case, you may want to consider the following approach: 1. Have the Solver constrain your decision variables as binary. 2. Have another set of cells which uses the decision variable to produce a result. When the underlying decision variabl...

Moving objects in VB.NET
I am using this code to move a button at run time. [code] If e.Button = Windows.Forms.MouseButtons.Left Then Button1.Capture = False Dim msg As Message = _ Message.Create(Button1.Handle, WM_NCLBUTTONDOWN, _ New IntPtr(HTCAPTION), IntPtr.Zero) Me.DefWndProc(msg) End If [/code] Everything works as planned, however, I can not click on the button. It basically freezes the click event and is only movable. I was told to confirm the location on the mouse up event, but do not exactly know what that means. Can anyone help me on this subject? Thanks in advance What do you ...