Input Box

usercenter93

New Member
Joined
Apr 22, 2015
Messages
9
Hello,
i have created a programm that asks for an input Column and then creates an average of the 60 values and then next 60 values and so on. I want that insteas of input of Column(A,B) I will input the variable with which the column have been named , like the column L have been named as Power. so i input power instead of L .

Sub Hourlyaverage()
Dim i As Long, j As Long, k As Long
Dim myRange As Range
Dim myValue As Variant

Sheets("DUT1_Test51_excel").Select

i = 3
j = 3
k = 63
myValue = InputBox("Give Column name to calculate Average eg. A,B")

Do While Cells(i, 12).Value <> ""


Set myRange = Range(myValue & i & ":" & myValue & k)
Cells(j, 20).Value = Application.Average(myRange)

i = i + 60
j = j + 1
k = k + 60
Loop


End Sub
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.

Forum statistics

Threads
1,216,051
Messages
6,128,501
Members
449,455
Latest member
jesski

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