Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default sheets.select with reference to Cells value

Hi,

I am designing vba macro where i have to select a particular sheets
depending of name in a cell ("A12").

"A12" value is always a text. its value change from day to day.
The sheet with "A12" value as name does exist in the workbook

I tried this macro based on the newsgroup archives, but it copies A12
value on "index" sheets rather than "A12" name sheet.
Any idea how to select this sheet?


Sub test()

Dim i As Integer
Sheets("index").Select
namsh = Range("A12").Value

For i = 1 To Sheets.Count
If Sheets(i).Name = namsh Then
Sheets(i).Select
End If
Next i

Range("I1").Value = namsh

End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,120
Default sheets.select with reference to Cells value

Sub test()

Dim i As Integer
Sheets("index").Select
namsh = Range("A12").Value

For i = 1 To Sheets.Count
If Sheets(i).Name = namsh Then
Sheets(i).Range("I1").Value = namsh
Exit For
End If
Next i



End Sub


--
HTH

Bob Phillips

wrote in message
ups.com...
Hi,

I am designing vba macro where i have to select a particular sheets
depending of name in a cell ("A12").

"A12" value is always a text. its value change from day to day.
The sheet with "A12" value as name does exist in the workbook

I tried this macro based on the newsgroup archives, but it copies A12
value on "index" sheets rather than "A12" name sheet.
Any idea how to select this sheet?


Sub test()

Dim i As Integer
Sheets("index").Select
namsh = Range("A12").Value

For i = 1 To Sheets.Count
If Sheets(i).Name = namsh Then
Sheets(i).Select
End If
Next i

Range("I1").Value = namsh

End Sub



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default sheets.select with reference to Cells value

Thanks ;-))

I am so stupid. i came to realise that it was B12 instead of A12 so
obviously it could not find any sheet.
lost 1h15 on that .... luckyly, it is friday evening ;-))

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
Up down arrow keys do not select cells if select locked cells unch roandrob Excel Discussion (Misc queries) 3 May 18th 09 12:48 AM
Macro to select cells without a certain value and select a menu it Guy[_2_] Excel Worksheet Functions 9 January 2nd 09 05:21 PM
Using formulas to select cells (Ex: Select every nth cell in a col Lakeview Photographic Services Excel Discussion (Misc queries) 2 March 15th 07 02:17 PM
how do you "select locked cells" w/o "select unlocked cells"? princejohnpaulfin Excel Discussion (Misc queries) 3 July 16th 05 03:53 AM
select sheets by name - how? Walt[_2_] Excel Programming 5 July 30th 03 10:42 PM


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