All,
I am trying to code in a dynamic print area. I have a section of code that works, but doesn't quite get what I want. Then I have what I think should be the adjustment but it is not working.
Working (but not quite there):
That renders a print area of, say, "B4:F12, B15:BE21", which is good, except for one thing: that BE21 is static. What I need for the very end to be able to do is adjust based on the amount of data entered. I have always used an INDIRECT function to do this with success. The problem, this time, is that I don't want the column letter in the Indirect to be static either (it should be adjusted). Here's what I've tried:
This renders a print area of "B4:BE15". I don't know why. It ignores the comma and the indirect does not stay in. I'd want the finished product to look like this:
"B4:F12, B15:Indirect(c3 & (d3 + e3))"
I would have c3 set as a column letter and d3 and e3 set as numbers based on Vendor_Count and then a count of the lines of data in the table.
Convoluted, I know, but I'm hoping someone can help!
Thank you!
I am trying to code in a dynamic print area. I have a section of code that works, but doesn't quite get what I want. Then I have what I think should be the adjustment but it is not working.
Working (but not quite there):
Code:
[FONT=Arial][SIZE=2][COLOR=#000000] .PrintArea = "$B$4:" & _
Cells(7 + Vendor_Count, 3 + SQC_Count).Address & _
"," & _
Cells(9 + Vendor_Count, 2).Address & _
":" & _
Cells((15 + Vendor_Count + Range("b" & (11 + Vendor_Count)).Value), 8 + Metric_Count).Address[/COLOR][/SIZE][/FONT]
</pre>
That renders a print area of, say, "B4:F12, B15:BE21", which is good, except for one thing: that BE21 is static. What I need for the very end to be able to do is adjust based on the amount of data entered. I have always used an INDIRECT function to do this with success. The problem, this time, is that I don't want the column letter in the Indirect to be static either (it should be adjusted). Here's what I've tried:
Code:
.PrintArea = "$B$4:" & Cells(7 + Vendor_Count, 3 + SQC_Count).Address & _
"," & _
Cells(9 + Vendor_Count, 2).Address & _
":Indirect($c$3&($d$3+$e$3))"
This renders a print area of "B4:BE15". I don't know why. It ignores the comma and the indirect does not stay in. I'd want the finished product to look like this:
"B4:F12, B15:Indirect(c3 & (d3 + e3))"
I would have c3 set as a column letter and d3 and e3 set as numbers based on Vendor_Count and then a count of the lines of data in the table.
Convoluted, I know, but I'm hoping someone can help!
Thank you!