Hi,
I'm somewhat new to VBA and I never use Excel for its intended purpose (I typically use it for inventory lists, etc).
(I'm not involved with plottind/visualization, as a rule of thumb).
I did work with VB6 for a few years, back in pre .NET days though. For my day-day work, I use Python and a proprietary
scripting language, where I work.
I'm running Office /Excel 2013 (I think) on Windows 7 Pro, 64-Bit.
However I've got a short term project to automate what is now being done manually.
Opening a logfile, copying and pasting the data into Excel, and generating plots.
Fortunately, the plots have already been created by someone knowledgable in Excel, I'm just populating the
rows & columns with data I've copied from the logfile, via an editor.
That said, I've made pretty good progress reading the data from the logfile into a VBA Collection,
now I'm trying to get that data into the appropriate rows & columns in a worksheet.
For reasons I've been struggling with for many days, when I'm able to make the cell.offset field compile/run,
the Cell object keeps populating the same starting Cell #, which is J8. This makes no sense to me.
At the moment, I'm doing something wrong and cannot even get the Cell.proprty field to work.
I keep running into this issue, but don't know why.
I've googled my brains out and tried many answers tht were returned from the searches.
My approach may not make sense to you, it's what I've started with.
I simply want to populate a column of data, J8-J24, then proceeed to the next column.
The range_ object appears to give me that functionality. When range_ is moved during the second
iteration of the for loop, it is indeed pointing to column K8.
For now, I will manully increment the variables TestNumberCount and BlkSizeCount, in order that the data I need
to populate the spreadsheet is correct. I'll figure out how to iterate over the nested collections objects later.
Darn- why cant I attach a screenshot of my code?
I'm somewhat new to VBA and I never use Excel for its intended purpose (I typically use it for inventory lists, etc).
(I'm not involved with plottind/visualization, as a rule of thumb).
I did work with VB6 for a few years, back in pre .NET days though. For my day-day work, I use Python and a proprietary
scripting language, where I work.
I'm running Office /Excel 2013 (I think) on Windows 7 Pro, 64-Bit.
However I've got a short term project to automate what is now being done manually.
Opening a logfile, copying and pasting the data into Excel, and generating plots.
Fortunately, the plots have already been created by someone knowledgable in Excel, I'm just populating the
rows & columns with data I've copied from the logfile, via an editor.
That said, I've made pretty good progress reading the data from the logfile into a VBA Collection,
now I'm trying to get that data into the appropriate rows & columns in a worksheet.
For reasons I've been struggling with for many days, when I'm able to make the cell.offset field compile/run,
the Cell object keeps populating the same starting Cell #, which is J8. This makes no sense to me.
At the moment, I'm doing something wrong and cannot even get the Cell.proprty field to work.
I keep running into this issue, but don't know why.
I've googled my brains out and tried many answers tht were returned from the searches.
My approach may not make sense to you, it's what I've started with.
I simply want to populate a column of data, J8-J24, then proceeed to the next column.
The range_ object appears to give me that functionality. When range_ is moved during the second
iteration of the for loop, it is indeed pointing to column K8.
For now, I will manully increment the variables TestNumberCount and BlkSizeCount, in order that the data I need
to populate the spreadsheet is correct. I'll figure out how to iterate over the nested collections objects later.
Darn- why cant I attach a screenshot of my code?
Rich (BB code):
Sub PopulateWorksheet(PerformanceData As Collection, Sheetname As String, StartCell As String, EndCell As String, ColumnOffset As Integer)
Const TESTDESCRITEM As Integer = 1
Const DATAITEM As Integer = 2
Const IOPSITEM As Integer = 3
Const MBSITEM As Integer = 4
Dim BlockSize As String
Dim IOPs As String
Dim MBs As Variant
Dim BlkSizeCount As Integer
Dim TestNumberCount As Integer
Dim Cell As Range
Dim range_ As Range
Dim RowOffset As Integer
Dim PerfData As Object
Dim x As Integer
'Set range_ = Worksheets("My Try").Range("J8:J24")
Set range_ = Worksheets("My Try").Range("J8:Y24")
BlkSizeCount = 1
TestNumberCount = 1
RowOffset = 0
For Each Cell In range_ ' iterates over the columns in the range_ object
For BlkSizeCount = 1 To 17
MBs = PerformanceData.Item(TestNumberCount).Item(DATAITEM).Item(BlkSizeCount).Item(IOPSITEM)
Cell.Activate
Cell.NumberFormat = "General"
Cell.Value = CStr(MBs)
RowOffset = RowOffset + 1
Cell.Offset(rowoffset, 0) <- THIS IS THE PROBLEM!!!
Next BlkSizeCount
Next Cell
End Sub
Last edited by a moderator: