LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Updating total cells after column deletions.

Can you post sample of data that is on Shreveport and List worksheets along
with the column the data is located along with any formulas that are in the
cell. I can't tell from the posting where the #ref is occuring.

"Kevin Porter" wrote:

I have a worksheet that has a header column. Underneath it has two info
columns. There is a column between Hours and the date, there is another
column between names. I copy this sheet from another sheet which has
everyone's name then delete certain names based on office. I also delete the
hours columns on the names I keep as I do not need them and would have to
re-write many other modules which were based on the sheet not having that
column.

Someones Name Total
Hours Nov 1 - 15, 07 Hours Nov 1-15,07

86.67 2,500.00 86.67 2,500.00

I look at the name, if it is on the list I delete the Hours and (hours +1)
columns moving everything to the left, then I delete the two blank cells by
the name to line everything up again. The total figure adjusts correctly.
If the name is not on the list I delete the name column and the next 3
columns. When I do this the Total column does not update correctly and I get
a #ref in the cell. Here is the code:

With Sheets("Shreveport")
lastCol = .Cells(1, "IV").End(xlToLeft).Column
For i = lastCol To 1 Step -1
If Len(Trim(.Cells(1, i))) < 0 Then
If Application.CountIf(Workbooks("Employee List for Payroll1") _
.Worksheets("List").Columns(2), .Cells(1, i)) = 0 Then
.Columns(i).Delete
.Columns(i + 1).Delete
.Columns(i + 1).Delete
.Columns(i).Delete
ElseIf Application.CountIf(Workbooks("Employee List for Payroll1") _
.Worksheets("List").Columns(2), .Cells(1, i)) 0 Then
Range(Cells(2, i), Cells(65536, i + 1)).Select
Selection.Delete xlShiftToLeft
Range(Cells(1, i + 1), Cells(1, i + 2)).Select
Selection.Delete xlShiftToLeft
End If
End If
Next
End With

What can I do so the Total column continues to adjust itself? As that
column is what I base several other worksheets on.

Thanks,

Kevin Porter

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help updating 1 cell from other cells in same column Fernando@Sartorius Excel Discussion (Misc queries) 10 February 18th 10 02:07 PM
Total cells of one column based on the values in another column? Riccol New Users to Excel 10 February 1st 09 09:07 AM
Count number of cells and total in one column, based on another column suffix Pierre Excel Worksheet Functions 5 October 31st 07 12:28 AM
Because of row/column deletions, how do you reset the last cell? AndreaW Excel Discussion (Misc queries) 3 March 23rd 06 06:13 PM
calculate which cells in column A will give me the total of column Ken Excel Worksheet Functions 4 January 6th 05 06:25 AM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"