Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Cell Offset User Input

I am familiar with using cell offset to move the active cell to a
non-specific cell location in VB; however, I am wondering how difficult it
would be to build a user interface that would prompt the user to input the
number of rows/columns to move up/down left/right. I have used user-input
pop-up boxes before but only with a limited number of variables that could be
entered. Any help (or at least a start in the right direction) would be
greatly appreciated. Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Cell Offset User Input

Have you every used the userforms in VBA?
Start by going to VBA Window and from Insert Menu, select userform. Click
on Userform and select Hammer and Wrench button on toolbar to get the
toolbox. You can add RefEdit to accept text inputs. Can have more than one
Reffedit on the userform.

"ajvasel" wrote:

I am familiar with using cell offset to move the active cell to a
non-specific cell location in VB; however, I am wondering how difficult it
would be to build a user interface that would prompt the user to input the
number of rows/columns to move up/down left/right. I have used user-input
pop-up boxes before but only with a limited number of variables that could be
entered. Any help (or at least a start in the right direction) would be
greatly appreciated. Thanks

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Cell Offset User Input

You can use the InputBox function or InputBox Method to have the user enter a
cell location that they want to move to. The problem with these two
approaches is that you have to depend on the user to properly enter the data.
You can also write code with the input boxes that would allow the user to
enter an integer number for moving the cusor, but the direction of the move
would have to be predetermined unless you want to write a select case or
If...ElseIf... statement to work in conjunction with message box to allow the
user to make choices that the code can use their response to manipulate the
cursor.

To make this long story short, yes there are several ways to interface with
the user in selecting cells on a worksheet via VBA. It just depends on how
much code or UserForm controls the code writer wants to utilize.

"ajvasel" wrote:

I am familiar with using cell offset to move the active cell to a
non-specific cell location in VB; however, I am wondering how difficult it
would be to build a user interface that would prompt the user to input the
number of rows/columns to move up/down left/right. I have used user-input
pop-up boxes before but only with a limited number of variables that could be
entered. Any help (or at least a start in the right direction) would be
greatly appreciated. Thanks

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Cell Offset User Input

thanks for the suggestions - I will try them when I have some spare time
tomorrow
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Cell Offset User Input

This is what I came up with - I am not sure how I can build stronger controls
into it using If Then statements. Any thoughts...

Option Explicit

Sub MoveCell()
Dim rslt1 As Integer
Enternumber:
rslt1 = Application.InputBox("Enter the number of cells to space
down - use a negative number to space up")
Dim rslt2 As Integer
Enternumber2:
rslt2 = Application.InputBox("Enter the number of cells to space
right - use a negative number to space right")
ActiveCell.Offset([rslt1], [rslt2]).Activate
End Sub
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
VBA Code to have User input data for cell Bean Counter[_2_] Excel Discussion (Misc queries) 0 May 27th 10 09:56 PM
Have user input converted to uppercase in same cell as input? Shannonn New Users to Excel 1 June 20th 06 03:19 AM
Cell generation from user input question. Thundersixx Excel Programming 1 January 17th 06 05:25 PM
User input in cell Sean Excel Programming 3 October 29th 04 08:17 PM


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