How can I change Output(a Range Object) of an InputBox as the row changes

anilsharaf

New Member
Joined
Apr 8, 2014
Messages
43
Office Version
  1. 2007
Platform
  1. Windows
I have a procedure that takes it's range from an InputBox. It does something then selects next row. But range supplied by InputBox remains the same. Is there any way to change it relative to row change.

Data is:
Y HindiY EngY HistoryY Pol ScY GeoY Geo PracticleY TotGeoY EvsY TotalY PassFailAnnvl9thFinalY Percent of MarksY DivisionY Position in classY Sup Subjct_1Y Sup Subjct_2
2540441834084241169iwjd fganh
4061414740084841237mÙkh.kZ47.4II
2540441834084244169iwjd
2537341229083734145iwjd
3521260931083926130vuqÙkh.kZ

<colgroup><col><col><col><col><col span="2"><col span="2"><col><col><col><col><col><col><col></colgroup><tbody>
</tbody>

Code is

Sub supplemntry11thArtk_NotComplete()
'Change Starred ************** line according to NEED
'Select 1st cell of "PassOrFail" Colm
'This will work when Practicle and Project
'marks colm are also filled
'Dim AllSub()
Dim PassingMarks(), TheoryMarks(), SubNm(), SupSub(2)
PassingMarks = Array(33, 33, 33, 33, 25)
'SubNm = Array(Hindi,English,History,PolSc,Geography)
SubNm = Array("fganh", "vaxzsth", "vfrgkl", "jktuhfr", "Hkwxksy")


Dim absent As Integer
absent = 0: NoOfSubjects = 5




'*********************************
'Warning: Select First Cell of Result Colm


Response = MsgBox("Select First Cell of Result Colm", _
vbOKCancel + vbCritical + vbDefaultButton1, "Select Result Cell")

If Response = vbCancel Then
MsgBox "Programme Cancelled:Begin Again", _
vbOKOnly + vbCritical + vbInformation, _
"Programme Terminated"
Exit Sub
Else: GoTo GoAhead
End If


'*********************************
GoAhead:


Set RInput = Application.InputBox _
("Select All Subject excluding EVS", "Select Range", , , , , , 8)

x = RInput.Address(rowabsolute:=False, columnabsolute:=False, _
relativeto:=ActiveCell)
'y = Range(x)
Set AllSub = Range(x)


'For j = 1 To 10
For i = 1 To NoOfSubjects
ReDim Preserve TheoryMarks(i)
TheoryMarks(i) = AllSub(i)
Next i
'Erase TheoryMarks
'ActiveCell.Offset(1, 0).Select
'Next j






'*********************************







Do Until Selection = ""
If ActiveCell <> "iwjd" Then 'iwjd=SUPPL******************
GoTo lastline1

Else
j = 1

For i = 1 To NoOfSubjects
If TheoryMarks(i) < PassingMarks(i) _
Or TheoryMarks(i) = "abs" Then
SupSub(j) = SubNm(i)
j = j + j
End If
Next i
End If
ActiveCell.Offset(0, 4) = SupSub(1)
ActiveCell.Offset(0, 5) = SupSub(2)


lastline1:
ActiveCell.Offset(1, 0).Select
Erase SupSub
Loop



lastline2:


Exit Sub
End Sub
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off

Forum statistics

Threads
1,215,080
Messages
6,123,013
Members
449,093
Latest member
ikke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top