Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 83
Default Help with link

Hi,
I need some help with copying and pasting special (link) the value of one
cell into another.

This is part of the code that I'm using. I've tried almost everything with
the link and is not working

For Each c In Range(ActiveCell.Offset(0, 3).Address, lastC & i + 15)
If c.Interior.ColorIndex = 8 Then
Cells(DestRow, DestCol + 1).Value = c.Value
'I need to link the destination cell with c.value
Cells(DestRow, DestCol + 1).NumberFormat = "0.000"
Cells(DestRow, DestCol + 1).Interior.ColorIndex = 8
End If

Next

Any help would be more than appreciated.
Thanks
--
gaba :)
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,092
Default Help with link

Try something like this (untested, not sure if copy/paste sheet is same or
different)

For Each c In Range(ActiveCell.Offset(0, 3).Address, lastC & i + 15)
If c.Interior.ColorIndex = 8 Then
Range(Address(c)).Copy
Cells(DestRow, DestCol + 1).Select
ActiveSheet.Paste Link:=True
Application.CutCopyMode = False
Cells(DestRow, DestCol + 1).NumberFormat = "0.000"
Cells(DestRow, DestCol + 1).Interior.ColorIndex = 8
End If

Next

Mike F

"gaba" wrote in message
...
Hi,
I need some help with copying and pasting special (link) the value of one
cell into another.

This is part of the code that I'm using. I've tried almost everything with
the link and is not working

For Each c In Range(ActiveCell.Offset(0, 3).Address, lastC & i + 15)
If c.Interior.ColorIndex = 8 Then
Cells(DestRow, DestCol + 1).Value = c.Value
'I need to link the destination cell with c.value
Cells(DestRow, DestCol + 1).NumberFormat = "0.000"
Cells(DestRow, DestCol + 1).Interior.ColorIndex = 8
End If

Next

Any help would be more than appreciated.
Thanks
--
gaba :)



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 83
Default Help with link

Hi Mike.
Thanks for your answer. I'm getting a compile error (Sub of Function not
define) about the Address. I'll keep trying something else

Gaba

"Mike Fogleman" wrote:

Try something like this (untested, not sure if copy/paste sheet is same or
different)

For Each c In Range(ActiveCell.Offset(0, 3).Address, lastC & i + 15)
If c.Interior.ColorIndex = 8 Then
Range(Address(c)).Copy
Cells(DestRow, DestCol + 1).Select
ActiveSheet.Paste Link:=True
Application.CutCopyMode = False
Cells(DestRow, DestCol + 1).NumberFormat = "0.000"
Cells(DestRow, DestCol + 1).Interior.ColorIndex = 8
End If

Next

Mike F

"gaba" wrote in message
...
Hi,
I need some help with copying and pasting special (link) the value of one
cell into another.

This is part of the code that I'm using. I've tried almost everything with
the link and is not working

For Each c In Range(ActiveCell.Offset(0, 3).Address, lastC & i + 15)
If c.Interior.ColorIndex = 8 Then
Cells(DestRow, DestCol + 1).Value = c.Value
'I need to link the destination cell with c.value
Cells(DestRow, DestCol + 1).NumberFormat = "0.000"
Cells(DestRow, DestCol + 1).Interior.ColorIndex = 8
End If

Next

Any help would be more than appreciated.
Thanks
--
gaba :)




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default Help with link

Maybe:

Option Explicit
Sub testme01()

Dim c As Range
Dim lastC As String
Dim i As Long
Dim DestRow As Long
Dim DestCol As Long

'testing only
lastC = "E"
i = 3
DestRow = 3
DestCol = 18

For Each c In Range(ActiveCell.Offset(0, 3), Cells(i + 15, lastC))
If c.Interior.ColorIndex = 8 Then
With Cells(DestRow, DestCol + 1)
.Value = c.Value
'I need to link the destination cell with c.value
.NumberFormat = "0.000"
'or maybe???
.NumberFormat = c.NumberFormat
.Interior.ColorIndex = 8
End With
End If
Next c
End Sub



gaba wrote:

Hi,
I need some help with copying and pasting special (link) the value of one
cell into another.

This is part of the code that I'm using. I've tried almost everything with
the link and is not working

For Each c In Range(ActiveCell.Offset(0, 3).Address, lastC & i + 15)
If c.Interior.ColorIndex = 8 Then
Cells(DestRow, DestCol + 1).Value = c.Value
'I need to link the destination cell with c.value
Cells(DestRow, DestCol + 1).NumberFormat = "0.000"
Cells(DestRow, DestCol + 1).Interior.ColorIndex = 8
End If

Next

Any help would be more than appreciated.
Thanks
--
gaba :)


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 83
Default Help with link

Hi Dave. Glad to see you are around :)
I've tried your changes and still not linking. Is not even taking the value
of c...
Any ideas?

"Dave Peterson" wrote:

Maybe:

Option Explicit
Sub testme01()

Dim c As Range
Dim lastC As String
Dim i As Long
Dim DestRow As Long
Dim DestCol As Long

'testing only
lastC = "E"
i = 3
DestRow = 3
DestCol = 18

For Each c In Range(ActiveCell.Offset(0, 3), Cells(i + 15, lastC))
If c.Interior.ColorIndex = 8 Then
With Cells(DestRow, DestCol + 1)
.Value = c.Value
'I need to link the destination cell with c.value
.NumberFormat = "0.000"
'or maybe???
.NumberFormat = c.NumberFormat
.Interior.ColorIndex = 8
End With
End If
Next c
End Sub



gaba wrote:

Hi,
I need some help with copying and pasting special (link) the value of one
cell into another.

This is part of the code that I'm using. I've tried almost everything with
the link and is not working

For Each c In Range(ActiveCell.Offset(0, 3).Address, lastC & i + 15)
If c.Interior.ColorIndex = 8 Then
Cells(DestRow, DestCol + 1).Value = c.Value
'I need to link the destination cell with c.value
Cells(DestRow, DestCol + 1).NumberFormat = "0.000"
Cells(DestRow, DestCol + 1).Interior.ColorIndex = 8
End If

Next

Any help would be more than appreciated.
Thanks
--
gaba :)


--

Dave Peterson



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default Help with link

Do you really want a link? Just a formula that points back at that other cell?

With Cells(DestRow, DestCol + 1)
.formula = "=" & c.address(external:=true)
end with

I'm not sure how the destrow/destcol get changed, though.



gaba wrote:

Hi Dave. Glad to see you are around :)
I've tried your changes and still not linking. Is not even taking the value
of c...
Any ideas?

"Dave Peterson" wrote:

Maybe:

Option Explicit
Sub testme01()

Dim c As Range
Dim lastC As String
Dim i As Long
Dim DestRow As Long
Dim DestCol As Long

'testing only
lastC = "E"
i = 3
DestRow = 3
DestCol = 18

For Each c In Range(ActiveCell.Offset(0, 3), Cells(i + 15, lastC))
If c.Interior.ColorIndex = 8 Then
With Cells(DestRow, DestCol + 1)
.Value = c.Value
'I need to link the destination cell with c.value
.NumberFormat = "0.000"
'or maybe???
.NumberFormat = c.NumberFormat
.Interior.ColorIndex = 8
End With
End If
Next c
End Sub



gaba wrote:

Hi,
I need some help with copying and pasting special (link) the value of one
cell into another.

This is part of the code that I'm using. I've tried almost everything with
the link and is not working

For Each c In Range(ActiveCell.Offset(0, 3).Address, lastC & i + 15)
If c.Interior.ColorIndex = 8 Then
Cells(DestRow, DestCol + 1).Value = c.Value
'I need to link the destination cell with c.value
Cells(DestRow, DestCol + 1).NumberFormat = "0.000"
Cells(DestRow, DestCol + 1).Interior.ColorIndex = 8
End If

Next

Any help would be more than appreciated.
Thanks
--
gaba :)


--

Dave Peterson


--

Dave Peterson
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 83
Default Help with link

Dave, Thank you so much!
I wish one day I can write my code in such simple yet elegant way
Gaba

"Dave Peterson" wrote:

Do you really want a link? Just a formula that points back at that other cell?

With Cells(DestRow, DestCol + 1)
.formula = "=" & c.address(external:=true)
end with

I'm not sure how the destrow/destcol get changed, though.



gaba wrote:

Hi Dave. Glad to see you are around :)
I've tried your changes and still not linking. Is not even taking the value
of c...
Any ideas?

"Dave Peterson" wrote:

Maybe:

Option Explicit
Sub testme01()

Dim c As Range
Dim lastC As String
Dim i As Long
Dim DestRow As Long
Dim DestCol As Long

'testing only
lastC = "E"
i = 3
DestRow = 3
DestCol = 18

For Each c In Range(ActiveCell.Offset(0, 3), Cells(i + 15, lastC))
If c.Interior.ColorIndex = 8 Then
With Cells(DestRow, DestCol + 1)
.Value = c.Value
'I need to link the destination cell with c.value
.NumberFormat = "0.000"
'or maybe???
.NumberFormat = c.NumberFormat
.Interior.ColorIndex = 8
End With
End If
Next c
End Sub



gaba wrote:

Hi,
I need some help with copying and pasting special (link) the value of one
cell into another.

This is part of the code that I'm using. I've tried almost everything with
the link and is not working

For Each c In Range(ActiveCell.Offset(0, 3).Address, lastC & i + 15)
If c.Interior.ColorIndex = 8 Then
Cells(DestRow, DestCol + 1).Value = c.Value
'I need to link the destination cell with c.value
Cells(DestRow, DestCol + 1).NumberFormat = "0.000"
Cells(DestRow, DestCol + 1).Interior.ColorIndex = 8
End If

Next

Any help would be more than appreciated.
Thanks
--
gaba :)

--

Dave Peterson


--

Dave Peterson

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
PASTE LINK option not available when I select PASTE SPECIAL to link an image in Excel to a Word document. tln Links and Linking in Excel 0 April 22nd 07 04:28 PM
if i sort cell that has link to another page how to keep link steve Bahrain Excel Discussion (Misc queries) 1 August 16th 06 01:20 PM
if i sort cell that has link to another page how to keep link steve Bahrain Excel Discussion (Misc queries) 0 August 16th 06 07:37 AM
Link to external link Chris Wong Excel Worksheet Functions 0 August 3rd 06 07:00 AM
Q: Changing a link without link validation Mike Frederick Excel Programming 3 December 2nd 03 11:02 PM


All times are GMT +1. The time now is 07:09 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"