LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default Cells.Find error Object variable or With block variable not set

Hello everyone

The message in the subjectline is displayed when running the code below:

Option Explicit
Sub FindWeek()
Dim DateCell As Range
Dim Rownr As Integer
Dim ColumnDep As Byte
Dim ShiftDown As Byte
Dim i As Byte

Dim Dsd As String
Dim Msd As String
Dim Ysd As String
Set DateCell = Range("SearchDate")
If Range("Dsd").Value < 10 Then
Dsd = "0" & Range("Dsd").Value
Else:
Dsd = Range("Dsd").Value
End If
If Range("Msd").Value < 10 Then
Msd = "0" & Range("Msd").Value
Else:
Msd = Range("Msd").Value
End If

Ysd = Range("Ysd").Value

DateCell = Dsd & "-" & Msd & "-" & Ysd

Sheets("TotaalTabel").Select

Cells.Find(What:=DateCell.Value, After:=ActiveCell, LookIn:=xlFormulas,
_
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False).Activate

Rownr = ActiveCell.Row
ColumnDep = 7
ShiftDown = 3

For i = 1 To 16
Range(Range("SearchDate").Offset(ShiftDown, 0), Range("SearchDate").
_
Offset(ShiftDown, 6)).Copy
Cells(Rownr, ColumnDep).PasteSpecial Paste:=xlPasteValues,
Operation:=xlNone, SkipBlanks _
:=False, Transpose:=True
ShiftDown = ShiftDown + 1
ColumnDep = ColumnDep + 1
Next i

End Sub




 
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
Runtime Error '91' Object variable or With block variable not set Alec Coliver Excel Discussion (Misc queries) 2 October 24th 09 02:29 PM
QueryTables Object Variable or With Block Variable Not Set Gjones Excel Programming 0 April 26th 04 10:09 PM
Object Variable or With Block Variable Not Set Dennis Excel Programming 5 April 22nd 04 02:40 PM
Pivot Table - Object variable or with block variable not set? George Nicholson[_2_] Excel Programming 1 April 16th 04 09:12 PM
Error 91 - Object variable with block variable not set Jim[_35_] Excel Programming 2 November 27th 03 03:34 AM


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

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"