Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,069
Default Name Range & Macro conflict

Hi,

I have a couple of sheets, one with a week on week budget, the other I want
to pull the budget data on.
I've named each weeks budget and tried to use the macro:

Dim Week, budgets
Week = InputBox("What budget week do you want to display?", "Budget Week")



Select Case Week
Case Is = 1
budgets = Sheets("Budget").Select
Application.Goto Reference:="WK1"

Case Is = 2
budgets = Sheets("Budget").Select
Application.Goto Reference:="WK2"





Case Else
Area = "but you don't seem to know your Budget week"

End Select


Range("I38").Select

Application.Goto Reference:=Worksheets("Budget").Range("Budgets"), _
scroll:=True

Selection.Copy
Sheets("Summary by Plant").Select
Range("I38").Select
ActiveSheet.Paste

Can't seem to find the right code to pull in the named range.

Any ideas please?

J
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4,339
Default Name Range & Macro conflict

I am guessing that the budgets are named Wk1, Wk2 (? ) so if so try this. I
commented out code which I think can be removed.

Sub a()
Dim Week, budgets
Week = InputBox("What budget week do you want to display?", "Budget Week")
If Week = "1" And Week <= "52" Then
Set rng = Sheets("Budget").Range("Wk" & Week)
Else
MsgBox "but you don't seem to know your Budget week"
' .......<=== whatever
End If


'Select Case Week
'Case Is = 1
'budgets = Sheets("Budget").Select
' Application.Goto Reference:="WK1"
'
'Case Is = 2
'budgets = Sheets("Budget").Select
' Application.Goto Reference:="WK2"
'
'
'
'
'
'Case Else
'Area = "but you don't seem to know your Budget week"
'
'End Select


Range("I38").Select

' Application.Goto Reference:=Worksheets("Budget").Range("Budgets"), _
' scroll:=True

Application.Goto Reference:=rng, scroll:=True

Selection.Copy
Sheets("Summary by Plant").Select
Range("I38").Select
ActiveSheet.Paste


End Sub


"John" wrote:

Hi,

I have a couple of sheets, one with a week on week budget, the other I want
to pull the budget data on.
I've named each weeks budget and tried to use the macro:

Dim Week, budgets
Week = InputBox("What budget week do you want to display?", "Budget Week")



Select Case Week
Case Is = 1
budgets = Sheets("Budget").Select
Application.Goto Reference:="WK1"

Case Is = 2
budgets = Sheets("Budget").Select
Application.Goto Reference:="WK2"





Case Else
Area = "but you don't seem to know your Budget week"

End Select


Range("I38").Select

Application.Goto Reference:=Worksheets("Budget").Range("Budgets"), _
scroll:=True

Selection.Copy
Sheets("Summary by Plant").Select
Range("I38").Select
ActiveSheet.Paste

Can't seem to find the right code to pull in the named range.

Any ideas please?

J

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
Range Name affecting speed of macro Richard Buttrey Excel Worksheet Functions 5 May 1st 06 03:06 PM
Identifying a Selected Range in a Macro DCSwearingen Excel Discussion (Misc queries) 4 April 25th 06 04:01 PM
checking that cells have a value before the workbook will close kcdonaldson Excel Worksheet Functions 8 December 5th 05 04:57 PM
Macro to change Chart Range when inserting a column Mark Charts and Charting in Excel 1 September 13th 05 01:12 PM
Macro - define cell range for a sum function Fad Excel Discussion (Misc queries) 2 June 6th 05 12:40 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"