Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Searching 1 column for data


Hello,

I would like to create a macro to search Column A for any entries & if
there is no data in Column A, insert the words "No Data" into Cell A2.
If there is data, then sort the data descending. I can sort the data,
but am not sure how to search the column ??

Thanks,

Oreg


--
Oreg
------------------------------------------------------------------------
Oreg's Profile: http://www.excelforum.com/member.php...fo&userid=9195
View this thread: http://www.excelforum.com/showthread...hreadid=381181

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Searching 1 column for data

Hi Oreg,

Set rng = Worksheets("Sheet1").Range("A:A")
If WorksheetFunction.CountA(rng) = 0 Then
' no data in column A
Worksheets("Sheet1").Range("A2") = "No Data"
End If

Ed Ferrero
http://edferrero.m6.net

I would like to create a macro to search Column A for any entries & if
there is no data in Column A, insert the words "No Data" into Cell A2.
If there is data, then sort the data descending. I can sort the data,
but am not sure how to search the column ??

Thanks,

Oreg



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Searching 1 column for data


Something like this probably:

If WorksheetFunction.CountA(Range("A:A")) = 0 Then
Range("A2") = "No Data"
Else
Columns("A:A").Select
Selection.Sort Key1:=Range("A1"), Order1:=xlAscending,
Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End If


Mangesh


--
mangesh_yadav
------------------------------------------------------------------------
mangesh_yadav's Profile: http://www.excelforum.com/member.php...o&userid=10470
View this thread: http://www.excelforum.com/showthread...hreadid=381181

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Searching 1 column for data


Mangesh & Ed,

Thanks for the responses....that's just what I needed !!

Ore

--
Ore
-----------------------------------------------------------------------
Oreg's Profile: http://www.excelforum.com/member.php...nfo&userid=919
View this thread: http://www.excelforum.com/showthread.php?threadid=38118

Reply
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
Searching data in a column via Input Box Chris New Users to Excel 2 April 29th 06 01:02 AM
Searching for partial data in a column Severin Excel Discussion (Misc queries) 2 October 3rd 05 06:33 PM
Searching a column Robert Pollock[_2_] Excel Programming 2 July 12th 04 01:54 PM
Searching In a Column KC[_3_] Excel Programming 4 April 15th 04 02:54 PM
Searching for Data Values in a Column - Formula Only Mark D'Agosta Excel Programming 4 September 29th 03 03:48 AM


All times are GMT +1. The time now is 01:55 PM.

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"