#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 6
Default Macro Problem

I would be grateful if somebody could help me to create a routine
within a macro that i have recorded. As you can see from the macro
below, a sheet within the existing workbook is copied, a hyperlink on
the original worksheet opens a template that the copied date is pasted
into. Rather handily and not by my design, it opens a copy of the
template without affecting the original. which is not the case if I
include instructions within the macro to open the template rather than
using the hyperlink.

My problem is that once i have saved/printed the document that i have
just created, and return to my orginal workbook, the cursor is over
the hyperlink. If I am not careful, I click the hyperlink which then
obviously opens the orignal template. How do I incorporate an
instruction in my macro to move the cursor to a specified cell within
this worksheet after it has hit the hyperlink and then returns to my
newly created workbook?

The purpose of all this is to avoid confusing other users of this
workbook if they inadvertantly click on the hyperlink itself.

Sub Letterv6()
'
' Letterv6 Macro
' Macro recorded 27.02.2007 by an Angel
'

'
Sheets(".").Select
Cells.Select
Selection.Copy
Sheets("Sales Tariff Calculator").Select
Range("B3").Select
Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Range("A1:K54").Select
Application.CutCopyMode = False
ActiveSheet.PageSetup.PrintArea = "$A$1:$K$70"
Range("A1").Select
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 9,101
Default Macro Problem

I made some changes. This works. Avoid using the .SELECT because it moves
the highligted cells.


Sub Letterv6()
'
' Letterv6 Macro
' Macro recorded 27.02.2007 by an Angel
'
Set Oldsheet = ActiveSheet
Cells.Copy
Sheets("Sales Tariff Calculator").Activate
Range("B3").Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
Selection.PasteSpecial Paste:=xlPasteValues, _
Operation:=xlNone, skipBlanks:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
skipBlanks:=False, Transpose:=False
Range("A1:K54").Select
Application.CutCopyMode = False
ActiveSheet.PageSetup.PrintArea = "$A$1:$K$70"
Oldsheet.Activate
Range("A1").Select
End Sub
"Angel_24477616" wrote:

I would be grateful if somebody could help me to create a routine
within a macro that i have recorded. As you can see from the macro
below, a sheet within the existing workbook is copied, a hyperlink on
the original worksheet opens a template that the copied date is pasted
into. Rather handily and not by my design, it opens a copy of the
template without affecting the original. which is not the case if I
include instructions within the macro to open the template rather than
using the hyperlink.

My problem is that once i have saved/printed the document that i have
just created, and return to my orginal workbook, the cursor is over
the hyperlink. If I am not careful, I click the hyperlink which then
obviously opens the orignal template. How do I incorporate an
instruction in my macro to move the cursor to a specified cell within
this worksheet after it has hit the hyperlink and then returns to my
newly created workbook?

The purpose of all this is to avoid confusing other users of this
workbook if they inadvertantly click on the hyperlink itself.

Sub Letterv6()
'
' Letterv6 Macro
' Macro recorded 27.02.2007 by an Angel
'

'
Sheets(".").Select
Cells.Select
Selection.Copy
Sheets("Sales Tariff Calculator").Select
Range("B3").Select
Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Range("A1:K54").Select
Application.CutCopyMode = False
ActiveSheet.PageSetup.PrintArea = "$A$1:$K$70"
Range("A1").Select
End Sub


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 6
Default Macro Problem

On 9 Mar, 10:51, Joel wrote:
I made some changes. This works. Avoid using the .SELECT because it moves
the highligted cells.

Sub Letterv6()
'
' Letterv6 Macro
' Macro recorded 27.02.2007 by an Angel
'
Set Oldsheet = ActiveSheet
Cells.Copy
Sheets("Sales Tariff Calculator").Activate
Range("B3").Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
Selection.PasteSpecial Paste:=xlPasteValues, _
Operation:=xlNone, skipBlanks:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
skipBlanks:=False, Transpose:=False
Range("A1:K54").Select
Application.CutCopyMode = False
ActiveSheet.PageSetup.PrintArea = "$A$1:$K$70"
Oldsheet.Activate
Range("A1").Select
End Sub



"Angel_24477616" wrote:
I would be grateful if somebody could help me to create a routine
within a macro that i have recorded. As you can see from the macro
below, a sheet within the existing workbook is copied, a hyperlink on
the original worksheet opens a template that the copied date is pasted
into. Rather handily and not by my design, it opens a copy of the
template without affecting the original. which is not the case if I
include instructions within the macro to open the template rather than
using the hyperlink.


My problem is that once i have saved/printed the document that i have
just created, and return to my orginal workbook, the cursor is over
the hyperlink. If I am not careful, I click the hyperlink which then
obviously opens the orignal template. How do I incorporate an
instruction in my macro to move the cursor to a specified cell within
this worksheet after it has hit the hyperlink and then returns to my
newly created workbook?


The purpose of all this is to avoid confusing other users of this
workbook if they inadvertantly click on the hyperlink itself.


Sub Letterv6()
'
' Letterv6 Macro
' Macro recorded 27.02.2007 by an Angel
'


'
Sheets(".").Select
Cells.Select
Selection.Copy
Sheets("Sales Tariff Calculator").Select
Range("B3").Select
Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Range("A1:K54").Select
Application.CutCopyMode = False
ActiveSheet.PageSetup.PrintArea = "$A$1:$K$70"
Range("A1").Select
End Sub- Hide quoted text -


- Show quoted text -


Thank you for your assistance Joel. The problem with this solution is
that the sheet "Sales Tariff Calculator" is now copied instead of the
sheet "." The Sales sheet is used for data entry while the "." sheet
takes selected data from the sales sheet and puts it in a nic letter
format. The hyperlink on the sales sheet then opens a template for
the data and formats from the "." sheet to be pasted into. The
desired result being that the user ends up looking at his copied data
within the new workbook that he can then either save, print email
etc. When she/he returns to the workbook with the Sales Tariff
Calculator, the cursor should be positioned in a cell other than the
one with the hyperlink in it.

Thanks & regards,
Angel

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
Macro problem Bonbon Excel Worksheet Functions 2 February 18th 06 08:07 PM
Macro problem tweacle Excel Worksheet Functions 0 February 15th 06 08:26 PM
Macro Problem tweacle Excel Worksheet Functions 1 January 12th 06 05:46 PM
Macro problem Frazer Excel Discussion (Misc queries) 3 August 18th 05 01:43 PM
macro problem Kevin Excel Discussion (Misc queries) 1 December 14th 04 10:47 PM


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