Hide Columns hides but then reappears

rplohocky

Active Member
Joined
Sep 25, 2005
Messages
292
Office Version
  1. 365
Platform
  1. Windows
Hello,
I have a strange one for ya. I highlight the columns that I want to hide then right click and select Hide but when i click on ANY cell in the sheet they reappear. I've tried 1 column, 2, 3 and more, same result. I have 5 sheets in this workbook and they are all the same. It has macros in it and I have been able to hide in the past so this is new.
 
  1. What makes you think it is “missing a decimal or 2”?
  2. What is the full error message?
  3. What line of code causes the error?
 
Upvote 0

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Hello Peter,
Sorry its been a while, I've been tied up. As far as the missing decimal, that's just a guess since other commands have been written very close to yours but have a decimal after "AutoFit". This is the line that is highlighted in yellow (AutoFitVisibleColumnsOnly) when i run the macro. I did try to add a decimal but that didn't change it. Keep in mind I know some VB but I'm no where where near you! ;)

With regard to your last question, the workbook is saved as a xlsm and i was wrong, I do have a macro that adds each cell in a row that is filled with Green. I have column A solid Green ( the refence column) and then column B looks down each row to see what has been filled with Green then keeps a running total. Here it is:

VBA Code:
Function SumCellsByColor(data_range As Range, cell_color As Range)
  Dim indRefColor As Long
  Dim cellCurrent As Range
  Dim sumRes

  Application.Volatile
  sumRes = 0
  indRefColor = cell_color.Cells(1, 1).Interior.Color
  For Each cellCurrent In data_range
    If indRefColor = cellCurrent.Interior.Color Then
      sumRes = WorksheetFunction.Sum(cellCurrent, sumRes)
    End If
  Next cellCurrent

  SumCellsByColor = sumRes
End Function
 
Upvote 0
I did a screen shot of the message i get when i insert a large number in a cell that requires the need to autofit the column.
 

Attachments

  • error message.jpg
    error message.jpg
    40.9 KB · Views: 4
Upvote 0
I did a screen shot of the message i get ...
Thanks. The problem is that you have commented out the code that I gave you before. The short 3-line code that I gave you in post 19 was just to trigger the other code to run.
Uncomment this procedure and try altering cells again

1707200820521.png
 
Upvote 0
Solution
It Works! Thank you for spending so much time on this issue, I did some testing and it works as I need it to, thanks again!
 
Upvote 0
Good news. Glad we got there in the end. Thanks for letting us know. :)
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,324
Members
452,635
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top