PC Review


Reply
Thread Tools Rate Thread

Change LinkedCell with VBA

 
 
Wingman
Guest
Posts: n/a
 
      27th Nov 2007
After searching in this group and lots of trial and error, I've
finally managed to get the following working:
1. Select a range on my sheet with form object in it, which have
linked cells to some cells (possibly on another sheet).
2. Have a macro change those links all at once to cells a couple of
rows lower.

This makes copying several comboboxen and listboxes a lot easier..

the code is for future users to spare them the work:

Sub TransposeLinkedCell()
offset = inputbox("Hoeveel regels moeten de verwijzigen in de
selectie veranderen? (+1 = naar onderen, -1 = naar boven)", "Verander
verwijzing", 15)
For Each s In ActiveSheet.Shapes
With s.BottomRightCell
If .Row > Selection.Row And .Row < Selection.Row +
Selection.Rows.Count Then
If s.ControlFormat.LinkedCell <> "" Then
Dim sheet, addr, fulladdr As String
fulladdr = s.ControlFormat.LinkedCell
Dim index As Integer
On Error Resume Next 'if no exclamation is found,
just resume
index = Application.WorksheetFunction.Search("!",
fulladdr)
If index > 0 Then
sheet = Left(s.ControlFormat.LinkedCell,
index)
End If
addr = Right(s.ControlFormat.LinkedCell,
Len(fulladdr) - index)
addr = ActiveSheet.Range(addr).offset(15).Address
s.ControlFormat.LinkedCell = sheet & addr
End If
End If
End With
Next
End Sub
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
LinkedCell sarndt Microsoft Excel Programming 2 15th Mar 2010 03:45 PM
Re: linkedcell property Bernard Liengme Microsoft Excel Programming 0 23rd Dec 2008 09:17 PM
LinkedCell problem TFriis Microsoft Excel Programming 4 27th Nov 2007 12:30 PM
setting LinkedCell using VBA michael.beckinsale Microsoft Excel Programming 2 1st Sep 2006 04:20 PM
Linkedcell Problems... cornishbloke Microsoft Excel Programming 3 21st Jan 2004 02:45 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:26 AM.