Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
mju mju is offline
external usenet poster
 
Posts: 29
Default Urgent help with input box & loop

I am trying to write a program using input box and a loop. I want the
program to ask the user for info for column c(blank cell), which is the
miles, then info for coln a, & B. The program will then take the given info
for col C then loop thru column A . Col C will then be populated with the
given miles until the state(col A) changes. Then another input box will pop
up prompting the user for the new state, miles, qty.

Below is a sample of my data
Col A(state) Col B(qty) Col C(Miles)
NY 2
NY 2
NY 2
TX 1
TX 1
CA 3

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 72
Default Urgent help with input box & loop

Try something like this:

Sub InputBoxLoop()
Dim r, c As Range, _
sState As String, _
lQty, lMiles As Long

sState = Range("A1").Value
lQty = InputBox("Input Quantity for " & sState)
lMiles = InputBox("Input Miles for " & sState)

Set r = Range("A1:A" & Range("A65536").End(xlUp).Row)

For Each c In r
If Not c.Value Like sState Then
sState = c.Value
lQty = InputBox("Input Quantity for " & sState)
lMiles = InputBox("Input Miles for " & sState)
End If
c.Offset(0, 1).Value = lQty
c.Offset(0, 2).Value = lMiles
Next c
End Sub

Regards,
David Miller
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
Input box with a loop aimee209 Excel Programming 4 March 4th 08 01:12 PM
URGENT LOOP ? Mike Excel Programming 9 October 19th 07 04:26 PM
URGENT- Can't get out of infinite loop J@Y Excel Discussion (Misc queries) 4 June 14th 07 09:41 PM
Urgent-Urgent VBA LOOP Jeff Excel Discussion (Misc queries) 0 October 6th 05 05:46 PM
Urgent Help needed on! Copy and Paste a Formula as Values using a Loop statement Edward S Excel Programming 4 June 26th 04 10:01 PM


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