Cell value into a variable

cccbzg

Board Regular
Joined
Oct 5, 2014
Messages
68
Office Version
  1. 365
Platform
  1. Windows
Hello,

I am getting an error on the line in red. Can't figure out why?? Something wrong with my syntax. Uggg. I'm trying to put a cell value into a variable called ENDHONORS. The cell value comes from a Msgbox entry and a line counter (i).

Any help would be much appreciated.

Thanks,
Bonnie

Sub HHPP()
With Sheets("WORKBOOK")
STUDENTcount = Sheets("WORKBOOK").Range("C" & 1).Value

lFinalRow = .Cells(.Rows.Count, "B").End(xlUp).Row
Set rngColA = .Range(.Cells(1, "B"), .Cells(lFinalRow, "B"))
End With

MsgBox "Number of students " & lFinalRow
Dim Honors As Integer
Dim HighPass As Integer
Dim Pass As Integer
Dim ENDHONORS As Double
Dim ENDHIGHPASS As Double

Honors = lFinalRow * 0.45
HighPass = lFinalRow * 0.4
Pass = lFinalRow * 0.15
HonorsHighPass = Honors + HighPass

MsgBox "honors count " & Honors
'MsgBox Honors

' Go through the rows

Sheets("WORKBOOK").Select

'** For Each cell In rngColA.Cells

Dim Selcol As String

Selcol = Application.InputBox("Enter Column code containing grades")

For i = 2 To lFinalRow

'Which column should be used to make the determination

If i = Honors Then ENDHONORS = Range(Selcol & i).Values
If i = Honors Then MsgBox "End of honors range " & ENDHONORS

If i = HonorsHighPass Then ENDHIGHPASS = Range(Selcol & i).Values
If i = HonorsHighPass Then MsgBox "End of High pass range " & ENDHIGHPASS
'
Next i



End Sub
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
I don't know if I am missing something but there is no property called Values.
If you replace your 2 references using .Values to .Value does it work ?

Too slow but edit won't let me delete. :)
 
Upvote 0
OMG. Feel quite silly, but still glad I posted. Just couldn't see that. Too late to be working.o_O

Thanks SO much!
 
Upvote 0

Forum statistics

Threads
1,214,911
Messages
6,122,199
Members
449,072
Latest member
DW Draft

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