Hello all;
I’m stuck! I have a bit of code that works just fine in a small developmental spreadsheet that I used to figure out if and how I could do this, but when I cut and paste it into my larger spreadsheet I get the following error.
“Object variable or With block variable not set”
It stops at the line “Intersect(myRow.EntireRow, myCol.EntireColumn).Activate”
The listboxes are named the same in both projects, and there are no naming conflicts.
You have already figured out that I am not a programmer. I like to play with VBA, but my activity mostly consists of finding code that almost does what I would like to accomplish and modifying it to suit, so I have a lot of trouble when I bump into these types of challenges.
The code works in one environment and not another and they appear to me to be similar and should present no conflicts. But I am obviously missing something here.
So, I don’t have a clue as to where to look for what is causing this grief. Any advice would be appreciated.
Thanks,
Ray
I’m stuck! I have a bit of code that works just fine in a small developmental spreadsheet that I used to figure out if and how I could do this, but when I cut and paste it into my larger spreadsheet I get the following error.
“Object variable or With block variable not set”
It stops at the line “Intersect(myRow.EntireRow, myCol.EntireColumn).Activate”
The listboxes are named the same in both projects, and there are no naming conflicts.
You have already figured out that I am not a programmer. I like to play with VBA, but my activity mostly consists of finding code that almost does what I would like to accomplish and modifying it to suit, so I have a lot of trouble when I bump into these types of challenges.
The code works in one environment and not another and they appear to me to be similar and should present no conflicts. But I am obviously missing something here.
So, I don’t have a clue as to where to look for what is causing this grief. Any advice would be appreciated.
Thanks,
Ray
Code:
Private Sub cmdOK_Click()
Dim myCol As Range
Dim myRow As Range
Dim myName As String
Dim number As String
ActiveWorkbook.Sheets("Sheet1").Activate
myName = lstName.Value
number = lstActivity.Value
Set myRow = Columns(1).Find(myName)
Set myCol = Rows(1).Find(number)
Intersect(myRow.EntireRow, myCol.EntireColumn).Activate
With Sheet1
ActiveCell.Select
ActiveCell.Value = Date
End With
End Sub