Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 386
Default Copy paste code for a #REF

Hi,

I am looking for a workbook code that runs when the file is opened. In col
H I have a formula (=INDIRECT(G8)) which searches data from another series of
folders. If the source folder is open it returns either a value or 0. If
the relevant source file is closed it returns a #REF.

What I would like is a code that looks through all the cells in Col H, if it
finds a numerical value or 0 it does a copy/paste values on the cells, if it
finds a #REF it does nothing.

The file is a update folder so the REFs will be in the future and the values
in the current/past which i need to keep to stop updates and allow the values
to be viewed irrespective of which folders are opened/closed.

Is this possible?
Thanks
LiAD
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Copy paste code for a #REF

Hi,

Try this with the worksheet changed to suit. Note that changing a formula to
UCASE has the effect of converting it to a value

Sub sonic()
Dim ws As Worksheet
Set ws = Sheets("Sheet1") 'Change to suit
lastrow = ws.Cells(Cells.Rows.Count, "H").End(xlUp).Row
Set MyRange = ws.Range("H1:H" & lastrow)
For Each c In MyRange
If IsNumeric(c.Value) Then
c.Value = UCase(c.Value)
End If
Next
End Sub

Mike

"LiAD" wrote:

Hi,

I am looking for a workbook code that runs when the file is opened. In col
H I have a formula (=INDIRECT(G8)) which searches data from another series of
folders. If the source folder is open it returns either a value or 0. If
the relevant source file is closed it returns a #REF.

What I would like is a code that looks through all the cells in Col H, if it
finds a numerical value or 0 it does a copy/paste values on the cells, if it
finds a #REF it does nothing.

The file is a update folder so the REFs will be in the future and the values
in the current/past which i need to keep to stop updates and allow the values
to be viewed irrespective of which folders are opened/closed.

Is this possible?
Thanks
LiAD

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 386
Default Copy paste code for a #REF

Perfect

thanks

"Mike H" wrote:

Hi,

Try this with the worksheet changed to suit. Note that changing a formula to
UCASE has the effect of converting it to a value

Sub sonic()
Dim ws As Worksheet
Set ws = Sheets("Sheet1") 'Change to suit
lastrow = ws.Cells(Cells.Rows.Count, "H").End(xlUp).Row
Set MyRange = ws.Range("H1:H" & lastrow)
For Each c In MyRange
If IsNumeric(c.Value) Then
c.Value = UCase(c.Value)
End If
Next
End Sub

Mike

"LiAD" wrote:

Hi,

I am looking for a workbook code that runs when the file is opened. In col
H I have a formula (=INDIRECT(G8)) which searches data from another series of
folders. If the source folder is open it returns either a value or 0. If
the relevant source file is closed it returns a #REF.

What I would like is a code that looks through all the cells in Col H, if it
finds a numerical value or 0 it does a copy/paste values on the cells, if it
finds a #REF it does nothing.

The file is a update folder so the REFs will be in the future and the values
in the current/past which i need to keep to stop updates and allow the values
to be viewed irrespective of which folders are opened/closed.

Is this possible?
Thanks
LiAD

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
Copy and paste code Rayo K Excel Programming 1 October 12th 06 05:08 PM
copy and paste using vb code ASU Excel Discussion (Misc queries) 1 September 10th 06 01:41 AM
Got the Copy/Cut Code But what is the Paste Code Corey Excel Programming 7 July 7th 06 02:23 PM
Help-Copy&Paste code Bourbon[_30_] Excel Programming 2 January 29th 04 02:47 PM
Need Help with Code - Copy & Paste JStone0218 Excel Programming 10 October 11th 03 04:09 PM


All times are GMT +1. The time now is 09:34 AM.

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

About Us

"It's about Microsoft Excel"