ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   select method of range class failed (https://www.excelbanter.com/excel-programming/311702-select-method-range-class-failed.html)

Joseph[_39_]

select method of range class failed
 

Dim users, Usersheet, date1 As String

Sheets("Sheet3").Select
Range("A1").Select
date1 = InputBox("Enter a date")
For i = 1 To 231
While Len(ActiveCell.Value) 0
users = ActiveCell.Value
If Dir("P:\clevedon staff\activities\" & users & "\" & users & date1 &
".xls") < "" Then
'users = ActiveCell.Value
'Do the stuff here


MsgBox ("File Exists")
Workbooks.Open FileName:= _
"\\FP06\apps\Clevedon Staff\Activities\" & users & "\" & users &
date1 & ".xls"

Range("B2:G25").Select 'error occurs here
Selection.Copy
ActiveWindow.ActivateNext
Range("B2:G25").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:=
_
False, Transpose:=False
Usersheet = ActiveCell.Value
Sheets(Usersheet).Close
Sheets("sheet3").Select

ActiveCell.Offset(1, 0).Select
Else

ActiveCell.Offset(1, 0).Select
End If
Wend
Next i

End Sub


--
Joseph


------------------------------------------------------------------------
Joseph's Profile: http://www.excelforum.com/member.php...fo&userid=5637
View this thread: http://www.excelforum.com/showthread...hreadid=264190



All times are GMT +1. The time now is 08:31 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com