Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default finds and concatenate

Hi all,

Column A has a cell which contains date format and in column A ther
are about 50 cells which contains date format .

What i want is that a macro which upon finding a cell with date forma
, selects all the cells below it until a blank line below them comes.

like if in cell A5 there is date format and 6 cells below it has dat
and then a blank line, what i want is that it selects all those cell
which are below the date cell and pastes them in the column B

and dates may be in cell A2, A8, A20 etc which may vary.
sometimes below the date formt cell there is no data, just a blan
line.
any help is appreciate

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default finds and concatenate

Vikram,

Not foolproof, but

Sub GetData()
Dim cLastRow
Dim i As Long
Dim j As Long

cLastRow = Cells(Rows.Count, "A").End(xlUp).Row
For i = 1 To cLastRow
If Cells(i, "A").NumberFormat Like "*d*" Then
For j = i + 1 To cLastRow
If Cells(j, "A").Value = "" Then
Exit For
End If
Next j
Range(Cells(i, "A"), Cells(j - 1, "A")).Copy Range("B1")
i = i + j - 1
End If
Next i
End Sub

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"vikram " wrote in message
...
Hi all,

Column A has a cell which contains date format and in column A there
are about 50 cells which contains date format .

What i want is that a macro which upon finding a cell with date format
, selects all the cells below it until a blank line below them comes.

like if in cell A5 there is date format and 6 cells below it has data
and then a blank line, what i want is that it selects all those cells
which are below the date cell and pastes them in the column B

and dates may be in cell A2, A8, A20 etc which may vary.
sometimes below the date formt cell there is no data, just a blank
line.
any help is appreciated


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default finds and concatenate

thanks bob!

ok, can we have a macro which upon finding the date format in a cell
clears not deletes the cells below it till a blank line appears belo
those cells

like if a date cell is A2, it clears A3&B3 in case if there is only on
row of data below date cell

in case there are more cells , it deletes all

thank u so much for ur hel

--
Message posted from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default finds and concatenate

Sub GetData()
Dim cLastRow
Dim i As Long
Dim j As Long

cLastRow = Cells(Rows.Count, "A").End(xlUp).Row
For i = 1 To cLastRow
If Cells(i, "A").NumberFormat Like "*d*" Then
For j = i + 1 To cLastRow
If Cells(j, "A").Value = "" Then
Exit For
End If
Next j
Range(Cells(i+1, "A"), Cells(j - 1, "A")).ClearContente
i = i + j - 1
End If
Next i
End Sub


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"vikram " wrote in message
...
thanks bob!

ok, can we have a macro which upon finding the date format in a cell ,
clears not deletes the cells below it till a blank line appears below
those cells

like if a date cell is A2, it clears A3&B3 in case if there is only one
row of data below date cell

in case there are more cells , it deletes all

thank u so much for ur help


---
Message posted from http://www.ExcelForum.com/



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
formula the finds value of cell above vpantus Excel Discussion (Misc queries) 2 November 9th 10 01:57 PM
lookup only finds #n/a's Janis Excel Discussion (Misc queries) 4 July 26th 07 11:02 PM
vlookup finds first match Janis Excel Discussion (Misc queries) 2 July 26th 07 04:56 PM
Which @function finds the mean of a number? Coffeecoco930 Excel Worksheet Functions 5 December 9th 04 03:11 AM
Multi-worksheet finds Andy Westlake Excel Programming 1 February 10th 04 06:21 PM


All times are GMT +1. The time now is 05:50 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"