View Full Version : Solved: Help with VBA Code
sandan
12-10-2009, 12:58 PM
Hi All,
This is my first post on this domain. I need your expert advise and help. I am using the below code to show a picture link in one of the sheets from the same workbook. However, the same does not work if I hide the source sheet i.e the "Formula" sheet. Can someone please help me change the code so that i hide the source sheet and still display the picture link in the target sheet i.e "Snapshot" sheet.
Sub proTest1()
Application.ScreenUpdating = False
Sheets("Snapshot").Select
ActiveSheet.Pictures.Delete
Sheets("Formula").Select
Range("N13:P36").Select
Selection.Copy
Sheets("Snapshot").Select
Range("B4").Select
ActiveSheet.Pictures.Paste(Link:=True).Select
End Sub
Thanking you in advance,
Srinivas:friends:
lucas
12-10-2009, 01:21 PM
Just unhide it in the code before you act on it and then rehide it when you are done.
Moved to Excel Help Forum.
sandan
12-10-2009, 01:39 PM
Just unhide it in the code before you act on it and then rehide it when you are done.
Moved to Excel Help Forum.
Thanks for a prompt reply. I think I was not very clear in expressing myself. The code above shows a picture link of the data in the adjacent sheet only when sheet containing the data is not hidden. I want it to show the the data even if the data sheet is hidden. Hope i make myself clear.
Formula sheet is the source sheet from i pick up data
Snapshot sheet is the target sheet where i show the picture link
I want the Formula sheet to be hidden and still be able to show the picture link in the Snapshot sheet.
Thanks & Regards
Srinivas
lucas
12-10-2009, 02:04 PM
It looks to me like you are navigating to the sheet "formula" copying a range and then navigating to sheet "snapshot" and pasting the range.
Option Explicit
Sub proTest1()
Application.ScreenUpdating = False
Sheets("Snapshot").Select
ActiveSheet.Pictures.Delete
Sheets("formula").Visible = True
Sheets("Formula").Select
Range("N13:P36").Select
Selection.Copy
Sheets("Snapshot").Select
Range("B4").Select
ActiveSheet.Pictures.Paste(Link:=True).Select
Sheets("formula").Visible = False
End Sub
You should try to avoid selection when you can. I didn't address it in your code so you could see where I added my code to it.
see attached.
sandan
12-10-2009, 02:23 PM
It looks to me like you are navigating to the sheet "formula" copying a range and then navigating to sheet "snapshot" and pasting the range.
Option Explicit
Sub proTest1()
Application.ScreenUpdating = False
Sheets("Snapshot").Select
ActiveSheet.Pictures.Delete
Sheets("formula").Visible = True
Sheets("Formula").Select
Range("N13:P36").Select
Selection.Copy
Sheets("Snapshot").Select
Range("B4").Select
ActiveSheet.Pictures.Paste(Link:=True).Select
Sheets("formula").Visible = False
End Sub
You should try to avoid selection when you can. I didn't address it in your code so you could see where I added my code to it.
see attached.
Thanks a lot friend. That worked fine for me.:friends:
lucas
12-10-2009, 02:33 PM
Please mark your thread solved using the thread tools at the top of the page so that others don't come here thinking that this is not resolved.
It is a waste of their time.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.