변수에 저장된 값을 Excel 시트에서 검색 할 응용 프로그램이 필요한 시트를 만듭니다.
".Find"함수를 사용하고 있습니다.
내 문제는 내가 실제 값을 입력 할 때 작동하지만 변수 이름에 저장되어있는 동안 찾을 값을 찾을 수 없다는 것입니다.VBA 찾기 함수가 변수와 함께 작동하지 않습니다.
예를 들어 :
는이 작동
Dim cellersd, celltid, ersdcol, tidcol
Set cellersd = book.Worksheets(mon & yer).Range("5:5").Find("28/08/2013")
Set celltid = book.Worksheets(mon1 & yer1).Range("5:5").Find("30/09/2013")
If cellersd Is Nothing Then
MsgBox "not found"
Else
MsgBox cellersd.Column
End If
If celltid Is Nothing Then
MsgBox "not found"
Else
MsgBox celltid.Column
End If
이 나던 일
rsd = Worksheets("workload").Range("p4").Value
tid = Worksheets("workload").Range("p3").Value
...
Dim cellersd, celltid, ersdcol, tidcol
Set cellersd = book.Worksheets(mon & yer).Range("5:5").Find(rsd)
Set celltid = book.Worksheets(mon1 & yer1).Range("5:5").Find(tid)
If cellersd Is Nothing Then
MsgBox "not found"
Else
MsgBox cellersd.Column
End If
If celltid Is Nothing Then
MsgBox "not found"
Else
MsgBox celltid.Column
End If
그 ... 코드에서 그냥 다른 작업
을 수행하는 inbetween 다른 코드를 보여줍니다오류가 있습니까? 나는 똑같이 작동 할 수있는 다른 검색 방법에 대한 제안에 대해서도 열려 있습니다. 고마워요. 나는 .Value
가 날짜가 아닌를 반환 생각
rsd = str(rsd)
tid = str(tid)
:
당신은 변수 문자열 또는 날짜 변수를 찾기 위해 노력하고 있습니까? –
'tid = Worksheets ("workload"). 범위 ("p3"). Value', 이것을 입력하고'Msgbox rsd & "와"& len (rsd)'무엇을 얻을 수 있는지 말해주세요 –
@SiddharthRout i 날짜에있는 문자의 길이가 – ChiomaJenni