saadalrahman
New Member
- Joined
- May 1, 2014
- Messages
- 4
Hello,
I am a complete newbie to vba and learning it on my own. I am trying to automate a very tedious process of monthly reporting using excel. The code below is what I have got using the Record Macro function and tweaking it quite a bit to suit my needs. I need to run a similar macro on multiple worksheets in one excel workbook. I want to know how I should proceed in creating the macro for the next worksheet. Do I have to define the worksheet name in each Sub so as not to create any conflicts with named ranges in other macros for other sheets? Where exactly would I need to define the worksheet in each? Really appreciate any help.
Sub PortfolioByCurrency()
'
'
'
Dim oldRange As Range
Range("A1").End(xlDown).Select
Set oldRange = Range(ActiveCell, ActiveCell.Offset(0, 5))
oldRange.Select
Selection.AutoFill Destination:=Range(oldRange, oldRange.Offset(1, 0)), Type:=xlFillDefault
oldRange.Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End Sub
I am a complete newbie to vba and learning it on my own. I am trying to automate a very tedious process of monthly reporting using excel. The code below is what I have got using the Record Macro function and tweaking it quite a bit to suit my needs. I need to run a similar macro on multiple worksheets in one excel workbook. I want to know how I should proceed in creating the macro for the next worksheet. Do I have to define the worksheet name in each Sub so as not to create any conflicts with named ranges in other macros for other sheets? Where exactly would I need to define the worksheet in each? Really appreciate any help.
Sub PortfolioByCurrency()
'
'
'
Dim oldRange As Range
Range("A1").End(xlDown).Select
Set oldRange = Range(ActiveCell, ActiveCell.Offset(0, 5))
oldRange.Select
Selection.AutoFill Destination:=Range(oldRange, oldRange.Offset(1, 0)), Type:=xlFillDefault
oldRange.Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End Sub