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: 414
Default input box method for macro

Hi all.
I recently obtained help making a macro and it works great.
As I've further studied it, I realize now that in order for it to become
truly viable I need an input box.
Below is the copy of the macro (at the bottom of page).
My desire at this point is to have an input box ask for the starting row,
the merged column, and then the location of the column that I want to sum,
and where I want it placed.
I have in fact downloaded the VBA description of the inputBox Method-- from
the MS VBE help file.
So, my questions are as follows:
1- the function is written as:
expression.inputbox(prompt, Title, Default, left, top, ......)

What is the "expression" that I'd need to make this work? From what I can
gather, it seems that I'd need one of the statements from the macro itself.

One example it gives is MyNum = application.inputbox(prompt := "enter number")
So, to make the cross over to my macro, it seems that I'd want MyNum to
actually be "iColMerge" and I'd input the numeerica value of my choosing. Is
this correct?
Then for the second input I'd want "iColFm" and I'd input the numeric value
of my choosing.
And for the third input I'd want "iColTo" and I'd then input the numeric
value of my choosing.
For the fourth input I'd want "iRowV" and then input the numerica value of
my choosing.
How many inputs can I have in a single input box, to accomplish my goal of
all of my primary inputs? (I hope that's clear, it not, let me know.)
Then, if I can have multiple inputs witrhin a single input box, how would I
set that up?
Thanks again for your assistance.
Best.

-----------------------Main macro code----------------

<Sub Sub1()
' I only want it looking at the merged rows of column C.
Const iColMerge = 3
' values located in column D to be summed
Const iColFm = 4
' I want the sum valued results in column e
Const iColTo = 5
Dim zCell As Range, iRowV&, iRowZ&, iRowN&
' to find last used cell in column
iRowZ = Cells(Rows.Count, iColMerge).End(xlUp).Row
iRowV = 1
Do While iRowV <= iRowZ
Set zCell = Cells(iRowV, iColMerge)
zCell.Select ' just to view
If zCell.MergeCells Then
' ck for merge type
If zCell.MergeArea.Columns.Count < 1 Then Stop ' ng
iRowN = iRowV + zCell.MergeArea.Rows.Count - 1
Cells(iRowV, iColTo).Formula = "=sum(" & _
Cells(iRowV, iColFm).Address & _
":" & _
Cells(iRowN, iColFm).Address & _
")"
iRowV = iRowN + 1 '
Else
iRowV = iRowV + 1
End If
Loop
End Sub

 
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
An alternate input method? TheMilkGuy Excel Discussion (Misc queries) 6 November 26th 08 07:12 AM
Using one Input Box Method For Two Separate Macros [email protected] Excel Programming 2 January 30th 07 01:24 AM
Using input box to improve my method cereldine[_35_] Excel Programming 2 May 25th 06 12:22 PM
need macro\method that would allow user input to a data filter CC_rider[_2_] Excel Programming 5 September 6th 05 06:08 PM
Numerical Input via an inputbox method Bob Phillips[_6_] Excel Programming 0 August 16th 04 07:30 PM


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