Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default How write to hidden columns with VBA?

Is there a way to write to hidden columns from vba without unhiding them first?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default How write to hidden columns with VBA?

The fact that it is hidden should not stop you.

What problem are you experiencing?

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Michel" wrote in message
om...
Is there a way to write to hidden columns from vba without unhiding them

first?


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default How write to hidden columns with VBA?

"Bob Phillips" wrote:
The fact that it is hidden should not stop you.
What problem are you experiencing?


Correct, the problem is that it can't be found!
Set oFound = oWorksheet.Rows(1).Find(vColName, LookIn:=xlValues, LookAt:=xlWhole)

so, the error comes from trying to use the oFound which in Nothing

So I should have asked: How can I search in hidden columns?
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default How write to hidden columns with VBA?

This failed as you noted:

Sub tester1()
Rows(1).Value = "Z"
Range("M1").Value = "A"
Set oWorksheet = ActiveSheet
Range("A:AA").EntireColumn.Hidden = True
vColName = "A"
Set oFound = oWorksheet.Rows(1).Find(vColName, _
LookIn:=xlValues, LookAt:=xlWhole)
If Not oFound Is Nothing Then
Debug.Print oFound.Address
Else
Debug.Print "Not found"
End If

End Sub

This Worked - using xlFormulas rather than xlValues

Sub tester2()
Rows(1).Value = "Z"
Range("M1").Value = "A"
Set oWorksheet = ActiveSheet
Range("A:AA").EntireColumn.Hidden = True
vColName = "A"
Set oFound = oWorksheet.Rows(1).Find(vColName, _
LookIn:=xlFormulas, LookAt:=xlWhole)
If Not oFound Is Nothing Then
Debug.Print oFound.Address
Else
Debug.Print "Not found"
End If

End Sub

of course looking for something produced by a formula would not work.

--
Regards,
Tom Ogilvy

"Michel" wrote in message
m...
"Bob Phillips" wrote:
The fact that it is hidden should not stop you.
What problem are you experiencing?


Correct, the problem is that it can't be found!
Set oFound = oWorksheet.Rows(1).Find(vColName, LookIn:=xlValues,

LookAt:=xlWhole)

so, the error comes from trying to use the oFound which in Nothing

So I should have asked: How can I search in hidden columns?



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default How write to hidden columns with VBA?

Cells(1,10).Value = 1000
puts 1000 in Cell J1 whether the column is hidden or not

--
Regards,
Tom Ogilvy

"Michel" wrote in message
om...
Is there a way to write to hidden columns from vba without unhiding them

first?




Reply
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
2007 Worksheet, Hidden Columns, .CSV Format Saves Hidden Column Da Tammy Excel Discussion (Misc queries) 3 April 2nd 09 11:40 PM
Copy and Paste with hidden columns remaining hidden Pendelfin Excel Discussion (Misc queries) 2 February 26th 09 11:35 AM
Hidden rows columns won't stay hidden christie Excel Worksheet Functions 0 September 30th 08 05:44 PM
Hidden Columns No Longer Hidden after Copying Worksheet? EV Nelson Excel Discussion (Misc queries) 1 December 6th 06 05:10 PM
How to keep hidden columns hidden using protection Dave Excel Discussion (Misc queries) 1 March 1st 06 02:20 AM


All times are GMT +1. The time now is 02:30 PM.

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"