Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro related question

Hi - I have an Excel workbook containing a large number of worksheets.
Within each worksheet I would like to run a macro to calculate som
dates/numbers/etc.

Is it possible to create a single macro for use on each workshee
within the workbook? I have gotten the macro to run on which eve
worksheet I am viewing, but it returns to me the data from th
worksheet it was originally created upon.

Please advise.

Advance thanks,

Michae

--
Message posted from http://www.ExcelForum.com

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro related question

Thankyou, Don, for the response.

I am a little new to this could you help me to better understand you
response.

Michae

--
Message posted from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default Macro related question

You should post your coding efforts for assistance.

--
Don Guillett
SalesAid Software

"Webem0ch " wrote in message
...
Thankyou, Don, for the response.

I am a little new to this could you help me to better understand your
response.

Michael


---
Message posted from
http://www.ExcelForum.com/



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro related question

Sub TWBirthdayRelated()
'
' TWBirthdayRelated Macro
' Macro recorded 5/3/2004 by mweber
'
' Keyboard Shortcut: Ctrl+a
'
Range("Q18:R18").Select
Selection.Copy
Range("Q19:R19").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone
SkipBlanks _
:=False, Transpose:=False
Range("R19").Select
Application.CutCopyMode = False
Selection.TextToColumns Destination:=Range("R19")
DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False
Tab:=False, _
Semicolon:=False, Comma:=False, Space:=False, Other:=True
OtherChar _
:="/", FieldInfo:=Array(Array(1, 1), Array(2, 1), Array(3, 1))
_
TrailingMinusNumbers:=True
Range("R19:T19").Select
Range("T19").Activate
Selection.NumberFormat = "0"
Range("R19:S19").Select
Selection.Copy
Range("R20:S24").Select
ActiveSheet.Paste
Range("T20").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=R[-1]C+1"
Range("T20").Select
Selection.AutoFill Destination:=Range("T20:T24")
Type:=xlFillDefault
Range("T20:T24").Select
Range("U19").Select
ActiveCell.FormulaR1C1 = "=RC[-3]&""/""&RC[-2]&""/""&RC[-1]"
Range("U19").Select
Selection.AutoFill Destination:=Range("U19:U24")
Type:=xlFillDefault
Range("U19:U24").Select
Selection.Copy
Range("R19:R24").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Selection.NumberFormat = "[$-409]mmmm d, yyyy;@"
Range("R19").Select
ActiveCell.FormulaR1C1 = "6/21/2003"
Range("R20").Select
ActiveCell.FormulaR1C1 = "6/21/2004"
Range("R21").Select
ActiveCell.FormulaR1C1 = "6/21/2005"
Range("R22").Select
ActiveCell.FormulaR1C1 = "6/21/2006"
Range("R23").Select
ActiveCell.FormulaR1C1 = "6/21/2007"
Range("R24").Select
ActiveCell.FormulaR1C1 = "6/21/2008"
Range("S19:U24").Select
Selection.ClearContents
Range("R25").Select
End Su

--
Message posted from http://www.ExcelForum.com



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default Macro related question

Here is an idea (UNTESTED) to shorten your code and do each worksheet. Have
a look at each modification to see what is happening. Try on a workbook with
another name.

for each ws in worksheets
Range("Q19:R19").value=Range("Q18:R18")
Range("R19").TextToColumns Destination:=Range("R19"),
DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False,
Tab:=False, _
Semicolon:=False, Comma:=False, Space:=False, Other:=True,
OtherChar _
:="/", FieldInfo:=Array(Array(1, 1), Array(2, 1), Array(3, 1)), _
TrailingMinusNumbers:=True

Range("R19:T19").NumberFormat = "0"
Range("R19:S19").Copy Range("R20:S24")
Range("T20").FormulaR1C1 = "=R[-1]C+1"
Range("T20").AutoFill Destination:=Range("T20:T24"),Type:=xlFillDefault

'Range("T20:T24").Select 'not sure what is happening here

Range("U19").FormulaR1C1 = "=RC[-3]&""/""&RC[-2]&""/""&RC[-1]"
rangeg("u19").AutoFill Destination:=Range("U19:U24"),Type:=xlFillDefault
Range("R19:R24").value=Range("U19:U24")
'Selection.NumberFormat = "[$-409]mmmm d, yyyy;@"
Range("R19") = "6/21/2003"
Range("R20") = "6/21/2004"
Range("R21") = "6/21/2005"
Range("R22") = "6/21/2006"
Range("R23") = "6/21/2007"
Range("R24") = "6/21/2008"
Range("S19:U24").ClearContents
next ws

--
Don Guillett
SalesAid Software

"Webem0ch " wrote in message
...
Sub TWBirthdayRelated()
'
' TWBirthdayRelated Macro
' Macro recorded 5/3/2004 by mweber
'
' Keyboard Shortcut: Ctrl+a
'
Range("Q18:R18").Select
Selection.Copy
Range("Q19:R19").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Range("R19").Select
Application.CutCopyMode = False
Selection.TextToColumns Destination:=Range("R19"),
DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False,
Tab:=False, _
Semicolon:=False, Comma:=False, Space:=False, Other:=True,
OtherChar _
:="/", FieldInfo:=Array(Array(1, 1), Array(2, 1), Array(3, 1)),
_
TrailingMinusNumbers:=True
Range("R19:T19").Select
Range("T19").Activate
Selection.NumberFormat = "0"
Range("R19:S19").Select
Selection.Copy
Range("R20:S24").Select
ActiveSheet.Paste
Range("T20").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=R[-1]C+1"
Range("T20").Select
Selection.AutoFill Destination:=Range("T20:T24"),
Type:=xlFillDefault
Range("T20:T24").Select
Range("U19").Select
ActiveCell.FormulaR1C1 = "=RC[-3]&""/""&RC[-2]&""/""&RC[-1]"
Range("U19").Select
Selection.AutoFill Destination:=Range("U19:U24"),
Type:=xlFillDefault
Range("U19:U24").Select
Selection.Copy
Range("R19:R24").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Selection.NumberFormat = "[$-409]mmmm d, yyyy;@"
Range("R19").Select
ActiveCell.FormulaR1C1 = "6/21/2003"
Range("R20").Select
ActiveCell.FormulaR1C1 = "6/21/2004"
Range("R21").Select
ActiveCell.FormulaR1C1 = "6/21/2005"
Range("R22").Select
ActiveCell.FormulaR1C1 = "6/21/2006"
Range("R23").Select
ActiveCell.FormulaR1C1 = "6/21/2007"
Range("R24").Select
ActiveCell.FormulaR1C1 = "6/21/2008"
Range("S19:U24").Select
Selection.ClearContents
Range("R25").Select
End Sub


---
Message posted from
http://www.ExcelForum.com/



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
question related to Data Vaildation Dharmesh[_2_] Excel Worksheet Functions 1 May 18th 10 03:14 AM
Lookup related question Craig Excel Worksheet Functions 1 June 23rd 09 04:48 PM
date related question??? _Bigred Excel Worksheet Functions 1 January 4th 07 01:23 AM
Another Date related question.... Pete Dray Excel Worksheet Functions 7 June 18th 06 11:49 PM
Function Related Question Sandeep Arora Excel Discussion (Misc queries) 1 February 2nd 05 07:36 PM


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