ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   formulas refer to columns that are deleted (https://www.excelbanter.com/excel-programming/285880-formulas-refer-columns-deleted.html)

Sharon[_7_]

formulas refer to columns that are deleted
 
I have a workbook with a worksheet that gets refreshed
from a .prn file. Every 4 to 6 years there will be an
additional 2 columns for a week and then they will be
deleted.

I have formulas on another worksheet that refer to these
columns.

Anyone have any ideas on how to deal with this?
Of course once the column is gone I get an error in my
formula.

The .prn file is created by another program. I tried to
get the folks using that program to add those columns and
leave them there permanently (showing zeros when not used)
but apparently that is not possible. So I'm looking for
other ideas.

Thank you -
Sharon

pikus

formulas refer to columns that are deleted
 
The first thing that comes to mind is that you could start with
something like this:

Do
x = x + 1
Loop Until Cells(1, x).Value = ""

This will run until it comes to a blank column. Then you can run the
code one way or another based on that number

If x = 8 Then
blah blah blah
Else If x = 10
blah blah blah
End If

That is just one example of how you can use the information. Let
me know if you need further help. - Pikus
:D


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



All times are GMT +1. The time now is 07:50 AM.

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