2013-08-13 3 views
0
로 표시되는 날짜 목록에 있습니다.

현재 날짜 행이있는 스프레드 시트에서 작업하고 있지만 열 너비가 너무 좁기 때문에 모든 날짜가 #으로 표시됩니다. . 찾기 기능을 수행하려고하지만 열이 날짜를 볼 수있을만큼 넓 으면 작동합니다.Excel vba .Find() 함수는 #

나는 루프를 사용하는 방법에 대한 연구를하고 있지만, 함수를 호출 할 때마다 수천 개의 날짜가 있는지 살펴 봐야 만한다. 그래서 심각하게 나를 허물게 만들 것이다.

날짜로 실제로 날짜가없는 .Find 함수를 사용할 수 있는지 누가 알 수 있습니까? 유감스럽게도 날짜와 시간에 따라 행에 저장된 데이터에 액세스 할 수 있어야하므로 서식을 지정하는 데 충분한 열을 확장 할 수 없습니다.

답변

1

변경 매개 변수를 찾고 : 찾고에 =의 xlvalues ​​: =의 xlFormulas

Sub Macro1() 

    'Will find dates showing ##### where column width is not wide enough 
    Set a = Sheet1.Range("A:A").Find(What:=#8/22/2013#, LookIn:=xlFormulas, _ 
     LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _ 
     MatchCase:=False, SearchFormat:=False) 
    Debug.Print a.Address 

    'Error on dates showing ##### where column width is not wide enough 
    Set a = Sheet1.Range("A:A").Find(What:=#8/22/2013#, LookIn:=xlValues, _ 
     LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _ 
     MatchCase:=False, SearchFormat:=False) 
    Debug.Print a.Address 
End Sub