please help Not Selecting the row.

Arvind1977

Board Regular
Joined
Jul 21, 2006
Messages
108
--------------------------------------------------------------------------------

Dim LR As Long 'Last Row
Dim i As Long

LR = Range("a" & Rows.Count).End(xlUp).Row

For i = 86 To LR
Range("a85:J85").Value = Range("a" & i & ":J" & i).Value

Select Case UCase(Sheet1.Range("$B$2"))
Case "T"
Range("A7:by8").Select
Case "C"
Range("A21:Ax21").Select
Case "V"
Range("A23:CH23").Select

' If UCase(Range("b2")) = "T" Then
'If UCase(Range("C69")).Value = "Y" Then

' Range("A7:by8").Select
'Else

'Range("A23:cH23").Select
'End If
End Select


Call Vikky
Sleep 200
Next i

End Sub
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
This is a good game. We all just guess at what you mean, what works, what doesn't.
 
Upvote 0
Works for me...

I see a couple possible problems..

1.
Select Case UCase(Sheet1.Range("$B$2"))
That is using the CodeName for a sheet, not necessarily the same thing as the Name as you see on the Sheet's Tab.

in the VBA module, sheets are listed as
Sheet1 (Sheet1)
The part in parens (Sheet1), that is the name in the TAB, The other part is the CodeName. They are not necessarily the same.
To refer to the name as you see it on the tab, use Sheets("Sheet1").Range(...)
To refer to the CodeName, use Sheet1.Range(....)

2.
Range("A7:by8").Select

Since you specified a Sheet Name in the Select Case Ucase(Sheet1.Range(B2)) part, but you did NOT in the Range(..).Select part, maybe it IS selecting the range, just not on the Sheet that you EXPECT it to??

Try qualifying the Sheet Name EVERYWHERE you have a Range refernce.

3.
Are you SURE Sheet1.Range("B2") has just a SINGLE Letter in it? Check for Leading/Trailing Spaces...

Hope this helps..
 
Last edited:
Upvote 0
4.
Try to avoid using Select in the first place. It is almost never required to select a range to manipulate it..
 
Upvote 0

Forum statistics

Threads
1,214,645
Messages
6,120,711
Members
448,984
Latest member
foxpro

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top