ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Silly question (https://www.excelbanter.com/excel-programming/294216-silly-question.html)

ksnapp[_41_]

Silly question
 
If I can find somthing like the worksheet function frequency in th
object browser I should be abble to use it right.

i use application.worksheetfunction.frequency and vba give me a ru
time error 1004 unable to get frequency property from worksheetfunctio
class.

is this normal or am I doin somethin wrong

--
Message posted from http://www.ExcelForum.com


Frank Kabel

Silly question
 
Hi
could you post the complete code (or at least the relevant part).

--
Regards
Frank Kabel
Frankfurt, Germany

"ksnapp " schrieb im
Newsbeitrag ...
If I can find somthing like the worksheet function frequency in the
object browser I should be abble to use it right.

i use application.worksheetfunction.frequency and vba give me a run
time error 1004 unable to get frequency property from

worksheetfunction
class.

is this normal or am I doin somethin wrong?


---
Message posted from http://www.ExcelForum.com/



ksnapp[_42_]

Silly question
 
Sub frequency_helper()

Dim LRindex As Single
Dim ColumnToWork As Single
Dim namerow As Single
Dim interm As Long
Dim Rng1 As Range
Dim LCdata As Single
Dim name As String
Dim DayNumber As Single
Dim col1 As New Collection

DayNumber = 1
ColumnToWork = 2

Worksheets("frequency").Select
With Worksheets("frequency")

name = Cells(2, ColumnToWork).Value

LRindex = Cells(Rows.Count, "A").End(xlUp).Row
End With

Worksheets("zscore").Select
With Worksheets("zscore")
Range("a2:a16").Select
For Each cell In Selection
If cell.Value = name Then
namerow = cell.Row
End If
Next

LCdata = Cells(3, Columns.Count).End(xlToLeft).Columns
Range("a3", Cells(3, LCdata)).Select

For Each cell In Selection
If cell.Value = DayNumber Then
interm = cell.Column
col1.Add (Cells(namerow, interm).Value)
End If
Next

End With

Worksheets("frequency").Select
With Worksheets("frequency")
Set Rng1 = Range(Cells(3, 1), Cells(LRindex, 1))

Range(Cells(3, ColumnToWork), Cells(LRindex, ColumnToWork)).Select

Selection.Value = Application.WorksheetFunction.Frequency(col1, Rng1)

End With



MsgBox (name)
MsgBox (namerow)

End Su

--
Message posted from http://www.ExcelForum.com


Frank Kabel

Silly question
 
Hi
though not tested I assume that the usage of a collection object for
Frequency is not allowed

--
Regards
Frank Kabel
Frankfurt, Germany

"ksnapp " schrieb im
Newsbeitrag ...
Sub frequency_helper()

Dim LRindex As Single
Dim ColumnToWork As Single
Dim namerow As Single
Dim interm As Long
Dim Rng1 As Range
Dim LCdata As Single
Dim name As String
Dim DayNumber As Single
Dim col1 As New Collection

DayNumber = 1
ColumnToWork = 2

Worksheets("frequency").Select
With Worksheets("frequency")

name = Cells(2, ColumnToWork).Value

LRindex = Cells(Rows.Count, "A").End(xlUp).Row
End With

Worksheets("zscore").Select
With Worksheets("zscore")
Range("a2:a16").Select
For Each cell In Selection
If cell.Value = name Then
namerow = cell.Row
End If
Next

LCdata = Cells(3, Columns.Count).End(xlToLeft).Columns
Range("a3", Cells(3, LCdata)).Select

For Each cell In Selection
If cell.Value = DayNumber Then
interm = cell.Column
col1.Add (Cells(namerow, interm).Value)
End If
Next

End With

Worksheets("frequency").Select
With Worksheets("frequency")
Set Rng1 = Range(Cells(3, 1), Cells(LRindex, 1))

Range(Cells(3, ColumnToWork), Cells(LRindex, ColumnToWork)).Select

Selection.Value = Application.WorksheetFunction.Frequency(col1, Rng1)

End With



MsgBox (name)
MsgBox (namerow)

End Sub


---
Message posted from http://www.ExcelForum.com/




All times are GMT +1. The time now is 05:47 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com