LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 184
Default Referencing differenct ranges with one input box

I have this looping macro set up and would like to get it to go to different
cells on the same row. I'm trying to get it so that I can enter a number for
an individual and then have multiple input boxes pop up to ask different
questions and put those answers to those questions in different cells on the
same row but different column. All with only entering the persons number
once. Here is what I got.

The AGE = "_" & ACCOUNT & "a" is where I thought I could reference a
differnet range but it doesn't work

' Macro recorded 10/17/2005 by Jeremy Barth
'
' Keyboard Shortcut: Ctrl+e

Const TXTTITLE As String = "Turkey Trot Participants"
Const NUMBERMSG As String = "Enter Runner's Number"
Const NAMEMSG As String = "Enter Runner's Name"
Const AGEMSG As String = "Enter Runner's Age"
Const GENDERMSG As String = "Enter (1) for Male or (2) for Female"
Dim ACCOUNT As Variant
Dim Name As Variant
Dim AGE As Variant
Dim GENDER As Variant

Do

ACCOUNT = InputBox(NUMBERMSG, TXTTITLE)
If ACCOUNT = "" Then Exit Sub
ACCOUNT = "_" & ACCOUNT & "n"
AGE = "_" & ACCOUNT & "a"
If ACCOUNT = "_." Then
Application.Goto Reference:="MENU"
Exit Sub
Else

With Range(ACCOUNT)
Application.Goto Reference:=.Cells
Name = InputBox(NAMEMSG, TXTTITLE)
If Name = "" Then Exit Sub
If .HasFormula Then
.Formula = Name
Else
.Formula = Name
End If
End With
AGE = "_" & ACCOUNT & "a"
With Range(ACCOUNT)
ActiveCell.Offset(0, -2).Select
AGE = InputBox(AGEMSG, TXTTITLE)
If AGE = "" Then Exit Sub
If .HasFormula Then
.Formula = AGE
Else
.Formula = AGE
End If
End With
With Range(ACCOUNT)
ActiveCell.Offset(0, -1).Select
GENDER = InputBox(GENDERMSG, TXTTITLE)
If GENDER = "" Then Exit Sub
If .HasFormula Then
.Formula = GENDER
Else
.Formula = GENDER
End If
End With
End If
Loop
End Sub

TIA
 
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
referencing named ranges in VBA Dave F Excel Discussion (Misc queries) 5 January 25th 07 06:46 PM
Referencing Named Ranges ExcelRookie Excel Worksheet Functions 2 March 6th 06 12:50 PM
How do I add input data in the input ranges in drop down boxes. oil_driller Excel Discussion (Misc queries) 1 November 9th 05 10:31 PM
Referencing named ranges FinChase Excel Programming 1 October 4th 05 03:54 PM
Referencing cells with input boxes. George Sherman Excel Programming 3 January 18th 05 04:17 AM


All times are GMT +1. The time now is 03:02 AM.

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"