-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Excel VBA Interfaces & Implements; jqGrid
Also noted JavaScript jqGrid Demons within http://trirand.com/blog/jqgrid/jqgrid.html as a possible long-term infrastructure approach
- Loading branch information
Showing
12 changed files
with
360 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
VERSION 1.0 CLASS | ||
BEGIN | ||
MultiUse = -1 'True | ||
END | ||
Attribute VB_Name = "Cat" | ||
Attribute VB_GlobalNameSpace = False | ||
Attribute VB_Creatable = False | ||
Attribute VB_PredeclaredId = False | ||
Attribute VB_Exposed = False | ||
Implements IAnimal | ||
|
||
Private Sub IAnimal_Speak() | ||
Debug.Print "Meow" | ||
End Sub |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
VERSION 1.0 CLASS | ||
BEGIN | ||
MultiUse = -1 'True | ||
END | ||
Attribute VB_Name = "Dog" | ||
Attribute VB_GlobalNameSpace = False | ||
Attribute VB_Creatable = False | ||
Attribute VB_PredeclaredId = False | ||
Attribute VB_Exposed = False | ||
Implements IAnimal | ||
|
||
Private Sub IAnimal_Speak() | ||
Debug.Print "Woof" | ||
End Sub |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
VERSION 1.0 CLASS | ||
BEGIN | ||
MultiUse = -1 'True | ||
END | ||
Attribute VB_Name = "IAnimal" | ||
Attribute VB_GlobalNameSpace = False | ||
Attribute VB_Creatable = False | ||
Attribute VB_PredeclaredId = False | ||
Attribute VB_Exposed = False | ||
Sub Speak() | ||
End Sub |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
VERSION 1.0 CLASS | ||
BEGIN | ||
MultiUse = -1 'True | ||
END | ||
Attribute VB_Name = "ICalc" | ||
Attribute VB_GlobalNameSpace = False | ||
Attribute VB_Creatable = False | ||
Attribute VB_PredeclaredId = False | ||
Attribute VB_Exposed = False | ||
Sub Add() | ||
End Sub | ||
Sub Subract() | ||
End Sub |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
VERSION 1.0 CLASS | ||
BEGIN | ||
MultiUse = -1 'True | ||
END | ||
Attribute VB_Name = "ISummaryUpdater" | ||
Attribute VB_GlobalNameSpace = False | ||
Attribute VB_Creatable = False | ||
Attribute VB_PredeclaredId = False | ||
Attribute VB_Exposed = False | ||
Sub Update(engine As RuleEngine, sheet As Worksheet) | ||
End Sub | ||
|
||
Function GetVersion() As String | ||
End Function | ||
|
||
Function ClearSheet(ws As Worksheet) | ||
End Function | ||
Function FitAllColumns(ws As Worksheet) | ||
End Function |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
VERSION 1.0 CLASS | ||
BEGIN | ||
MultiUse = -1 'True | ||
END | ||
Attribute VB_Name = "SummaryUpdater" | ||
Attribute VB_GlobalNameSpace = False | ||
Attribute VB_Creatable = False | ||
Attribute VB_PredeclaredId = False | ||
Attribute VB_Exposed = False | ||
Implements ISummaryUpdater | ||
|
||
Private Function ISummaryUpdater_ClearSheet(ws As Worksheet) As Variant | ||
|
||
End Function | ||
|
||
Private Function ISummaryUpdater_FitAllColumns(ws As Worksheet) As Variant | ||
ws.Cells.Select | ||
ws.Cells.EntireColumn.AutoFit | ||
ws.Cells(1, 1).Select | ||
End Function | ||
|
||
Private Function ISummaryUpdater_GetVersion() As String | ||
ISummaryUpdater_GetVersion = "1.0" | ||
End Function | ||
|
||
Private Sub ISummaryUpdater_Update(engine As RuleEngine, sheet As Worksheet) | ||
Dim row As RowInfo | ||
Dim pRule As rule | ||
Dim offset As Integer | ||
|
||
Dim ColHeaders As New Collection | ||
ColHeaders.Add ("PriceL") | ||
ColHeaders.Add ("PriceB") | ||
|
||
Dim colHeader1 As String | ||
Dim colHeader2 As String | ||
Dim colHeader3 As String | ||
Dim colHeader4 As String | ||
|
||
colHeader1 = sheet.Range("B1").Value | ||
colHeader2 = sheet.Range("C1").Value | ||
' go through all available rules | ||
For Each pRule In engine.rules | ||
sheet.Range("A2").offset(offset, 0) = pRule.Category | ||
|
||
' Get total for each rule | ||
Dim pTotal1 As Double: pTotal1 = 0 | ||
Dim pTotal2 As Double: pTotal2 = 0 | ||
For Each row In engine.Rows | ||
If row.Category = pRule.Category Then | ||
pTotal1 = pTotal1 + row.Columns(colHeader1) | ||
pTotal2 = pTotal2 + row.Columns(colHeader2) | ||
End If | ||
Next | ||
sheet.Range("B2").offset(offset, 0) = pTotal1 | ||
sheet.Range("B2").offset(offset, 0).Interior.ColorIndex = 0 | ||
sheet.Range("C2").offset(offset, 0) = pTotal2 | ||
sheet.Range("C2").offset(offset, 0).Interior.ColorIndex = 0 | ||
|
||
offset = offset + 1 | ||
Next | ||
End Sub |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
VERSION 1.0 CLASS | ||
BEGIN | ||
MultiUse = -1 'True | ||
END | ||
Attribute VB_Name = "SummaryUpdaterAdd" | ||
Attribute VB_GlobalNameSpace = False | ||
Attribute VB_Creatable = False | ||
Attribute VB_PredeclaredId = False | ||
Attribute VB_Exposed = False | ||
Option Explicit | ||
Implements ISummaryUpdater | ||
|
||
Private Function ISummaryUpdater_ClearSheet(ws As Worksheet) As Variant | ||
ws.Range("A2:ZZ6000").ClearContents | ||
End Function | ||
|
||
Private Function ISummaryUpdater_FitAllColumns(ws As Worksheet) As Variant | ||
ws.Activate | ||
ws.Cells.Select | ||
ws.Cells.EntireColumn.AutoFit | ||
ws.Cells(1, 1).Select | ||
End Function | ||
|
||
Private Function ISummaryUpdater_GetVersion() As String | ||
|
||
End Function | ||
|
||
Private Sub ISummaryUpdater_Update(engine As RuleEngine, sheet As Worksheet) | ||
Dim row As RowInfo | ||
Dim pRule As rule | ||
Dim offset As Integer | ||
|
||
|
||
Dim r As Range | ||
Dim c As Range | ||
Set r = sheet.Range(sheet.Range("B1"), sheet.Range("B1").End(xlToRight)) | ||
'r.Select | ||
|
||
|
||
offset = 1 | ||
' go through all available rules | ||
For Each pRule In engine.rules | ||
sheet.Range("A2").offset(offset - 1, 0) = pRule.Category | ||
|
||
For Each row In engine.Rows | ||
If row.Category = pRule.Category Then | ||
|
||
For Each c In r | ||
c.offset(offset, 0).Value = c.offset(offset, 0).Value + row.Columns(c.Value) | ||
Next | ||
End If | ||
Next | ||
|
||
|
||
offset = offset + 1 | ||
Next | ||
|
||
End Sub |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
VERSION 1.0 CLASS | ||
BEGIN | ||
MultiUse = -1 'True | ||
END | ||
Attribute VB_Name = "SummaryUpdaterColorful" | ||
Attribute VB_GlobalNameSpace = False | ||
Attribute VB_Creatable = False | ||
Attribute VB_PredeclaredId = False | ||
Attribute VB_Exposed = False | ||
Implements ISummaryUpdater | ||
|
||
Private Function ISummaryUpdater_ClearSheet(ws As Worksheet) As Variant | ||
|
||
End Function | ||
|
||
Private Function ISummaryUpdater_FitAllColumns(ws As Worksheet) As Variant | ||
ws.Cells.Select | ||
ws.Cells.EntireColumn.AutoFit | ||
ws.Cells(1, 1).Select | ||
End Function | ||
|
||
Private Function ISummaryUpdater_GetVersion() As String | ||
ISummaryUpdater_GetVersion = "2.0" | ||
End Function | ||
|
||
Private Sub ISummaryUpdater_Update(engine As RuleEngine, sheet As Worksheet) | ||
|
||
Dim row As RowInfo | ||
Dim pRule As rule | ||
Dim offset As Integer | ||
Dim ColHeaders As New Collection | ||
ColHeaders.Add ("PriceL") | ||
ColHeaders.Add ("PriceB") | ||
|
||
Dim colHeader1 As String | ||
Dim colHeader2 As String | ||
Dim colHeader3 As String | ||
Dim colHeader4 As String | ||
|
||
colHeader1 = sheet.Range("B1").Value | ||
colHeader2 = sheet.Range("C1").Value | ||
' go through all available rules | ||
For Each pRule In engine.rules | ||
sheet.Range("A2").offset(offset, 0) = pRule.Category | ||
|
||
' Get total for each rule | ||
Dim pTotal1 As Double: pTotal1 = 0 | ||
Dim pTotal2 As Double: pTotal2 = 0 | ||
For Each row In engine.Rows | ||
If row.Category = pRule.Category Then | ||
pTotal1 = pTotal1 + row.Columns(colHeader1) | ||
pTotal2 = pTotal2 + row.Columns(colHeader2) | ||
End If | ||
Next | ||
sheet.Range("B2").offset(offset, 0) = pTotal1 | ||
sheet.Range("B2").offset(offset, 0).Interior.ColorIndex = 6 | ||
sheet.Range("C2").offset(offset, 0) = pTotal2 | ||
sheet.Range("C2").offset(offset, 0).Interior.ColorIndex = 7 | ||
|
||
offset = offset + 1 | ||
Next | ||
|
||
End Sub | ||
|
Oops, something went wrong.