Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Option Explicit
Sub testme() Dim NewColumn As String Dim NewColNum As Long Dim TestRng As Range NewColumn = InputBox("New Column", "New Column for Trends") Set TestRng = Nothing On Error Resume Next Set TestRng = Worksheets(1).Cells(1, NewColumn) On Error GoTo 0 If TestRng Is Nothing Then MsgBox "That's not a valid column" Exit Sub End If NewColNum = TestRng.Column 'then you could use NewColNum-1 to be the column to the right. With ActiveSheet MsgBox .Range("A1", .Cells(99, NewColNum - 1)).Address(0, 0) End With End Sub If you use .cells(x,y), the y portion represents the column. And excel's VBA will allow you to use either a string or a number as that argument. Mike Darrington wrote: I have an input box that asks the user to input a new column for a range to set the print area. I have on sheet that has one less column than the rest. Is there a way to have it take off on column? Here is what I have newcolumn = InputBox("New Column", "New Column for Trends") User puts in AJ On one sheet I only want it to go to AI is there a way to do this without asking another question? -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
divide column(x) by column(y) to give column(x/y) in excel? | New Users to Excel | |||
how do I do subtractions in excel | New Users to Excel | |||
Based on a condition in one column, search for a year in another column, and display data from another column in the same row look | Excel Discussion (Misc queries) | |||
Compare lists for additions and subtractions | Excel Worksheet Functions | |||
Divide Column A by Column B multiply Column C | Excel Worksheet Functions |