bnstates
02-24-2020, 02:02 PM
Hi all,
I have data in the following format that I'm trying to print to a text document:
Periods
1
2
3
4
5
Claim 1
500
200
300
Claim 2
100
200
As some background about the data set, a group can have claims in any period, and can also not be observed for certain periods (so in the above example, this group isn't observed for periods 4 & 5). My goal is to print out this data to a text document, where I want to keep the empty cells within the observed periods (such as claim 2 period 1), but don't want to keep the empty cells for non-observed periods. All ""Claims #" rows are contained within a single named range (named "Claims"), and there can be more than the 2 claims seen above (further numbers are hidden until used).
Here's my current code:
Set CurrentRng = Range("Claims").SpecialCells(xlCellTypeVisible)
For Each cell In CurrentRng
Print #SaveFileNum, .Name & Chr(9) & "Claims" & Chr(9) & cell
End If
Next cell
So here I'm printing the sheet name, range name, and values from the unhidden cells to a text document. I want to find a way to get rid of the 0 values from periods 4 & 5 as well.
I also have a "Periods" field that gives me the number of observed periods(i.e. in the above example Periods = 3).
Any ideas?
I have data in the following format that I'm trying to print to a text document:
Periods
1
2
3
4
5
Claim 1
500
200
300
Claim 2
100
200
As some background about the data set, a group can have claims in any period, and can also not be observed for certain periods (so in the above example, this group isn't observed for periods 4 & 5). My goal is to print out this data to a text document, where I want to keep the empty cells within the observed periods (such as claim 2 period 1), but don't want to keep the empty cells for non-observed periods. All ""Claims #" rows are contained within a single named range (named "Claims"), and there can be more than the 2 claims seen above (further numbers are hidden until used).
Here's my current code:
Set CurrentRng = Range("Claims").SpecialCells(xlCellTypeVisible)
For Each cell In CurrentRng
Print #SaveFileNum, .Name & Chr(9) & "Claims" & Chr(9) & cell
End If
Next cell
So here I'm printing the sheet name, range name, and values from the unhidden cells to a text document. I want to find a way to get rid of the 0 values from periods 4 & 5 as well.
I also have a "Periods" field that gives me the number of observed periods(i.e. in the above example Periods = 3).
Any ideas?