Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10
Default FIND-COPY DIFFERENT WORDS WITH MACRO

Hi,

I am trying to create a macro that will find the word "MONDAY" in column A,
then copy "MONDAY" (in every cell down to column A) and stop when it will
find the word "TUESDAY" and so on.
Can someone help me with this?
Thanks for your help!!!
Spyros

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,646
Default FIND-COPY DIFFERENT WORDS WITH MACRO

One solution:

Sub findday()
srcdir = xlNext
shiftback = 1
days = Array("Monday", "Tuesday", "Wednesday", "Thursday", "Friday",
"Saturday", "Sunday", "*")
For d = 1 To UBound(days) - 1
Columns("A:A").Select
On Error Resume Next
currdayrow = Selection.Find(What:=days(d), After:=ActiveCell,
LookIn:=xlValues, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Row
If Err = 0 Then
For nd = d + 1 To UBound(days)
On Error Resume Next
If nd = UBound(days) Then
srcdir = xlPrevious
Cells.Select
shiftback = 0
End If
nextdayrow = Selection.Find(What:=days(nd),
After:=ActiveCell, LookIn:=xlValues, _
LookAt:=xlPart, SearchOrder:=xlByRows,
SearchDirection:=srcdir, _
MatchCase:=False, SearchFormat:=False).Row
If Err = 0 Then
Range("A" & currdayrow + 1 & ":A" & nextdayrow -
shiftback).Value = days(d)
Exit For
End If
Next nd
End If
Next d
Range("A1").Select
End Sub

Regards,
Stefi


Spiros ezt *rta:

Hi,

I am trying to create a macro that will find the word "MONDAY" in column A,
then copy "MONDAY" (in every cell down to column A) and stop when it will
find the word "TUESDAY" and so on.
Can someone help me with this?
Thanks for your help!!!
Spyros

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10
Default FIND-COPY DIFFERENT WORDS WITH MACRO

stefi,
if i have numbers than days.
For example: 10.000, 20,000,30,000 ...

Ο χρήστης "Stefi" *γγραψε:

One solution:

Sub findday()
srcdir = xlNext
shiftback = 1
days = Array("Monday", "Tuesday", "Wednesday", "Thursday", "Friday",
"Saturday", "Sunday", "*")
For d = 1 To UBound(days) - 1
Columns("A:A").Select
On Error Resume Next
currdayrow = Selection.Find(What:=days(d), After:=ActiveCell,
LookIn:=xlValues, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Row
If Err = 0 Then
For nd = d + 1 To UBound(days)
On Error Resume Next
If nd = UBound(days) Then
srcdir = xlPrevious
Cells.Select
shiftback = 0
End If
nextdayrow = Selection.Find(What:=days(nd),
After:=ActiveCell, LookIn:=xlValues, _
LookAt:=xlPart, SearchOrder:=xlByRows,
SearchDirection:=srcdir, _
MatchCase:=False, SearchFormat:=False).Row
If Err = 0 Then
Range("A" & currdayrow + 1 & ":A" & nextdayrow -
shiftback).Value = days(d)
Exit For
End If
Next nd
End If
Next d
Range("A1").Select
End Sub

Regards,
Stefi


Spiros ezt *rta:

Hi,

I am trying to create a macro that will find the word "MONDAY" in column A,
then copy "MONDAY" (in every cell down to column A) and stop when it will
find the word "TUESDAY" and so on.
Can someone help me with this?
Thanks for your help!!!
Spyros

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,646
Default FIND-COPY DIFFERENT WORDS WITH MACRO

Just replace line
days = Array("Monday", "Tuesday", "Wednesday", "Thursday", "Friday",
"Saturday", "Sunday", "*")

by
days = Array(10000, 20000, 30000, 40000, 50000, 60000, 70000, "*")

Regards,
Stefi

Spiros ezt *rta:

stefi,
if i have numbers than days.
For example: 10.000, 20,000,30,000 ...

Ο χρήστης "Stefi" *γγραψε:

One solution:

Sub findday()
srcdir = xlNext
shiftback = 1
days = Array("Monday", "Tuesday", "Wednesday", "Thursday", "Friday",
"Saturday", "Sunday", "*")
For d = 1 To UBound(days) - 1
Columns("A:A").Select
On Error Resume Next
currdayrow = Selection.Find(What:=days(d), After:=ActiveCell,
LookIn:=xlValues, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Row
If Err = 0 Then
For nd = d + 1 To UBound(days)
On Error Resume Next
If nd = UBound(days) Then
srcdir = xlPrevious
Cells.Select
shiftback = 0
End If
nextdayrow = Selection.Find(What:=days(nd),
After:=ActiveCell, LookIn:=xlValues, _
LookAt:=xlPart, SearchOrder:=xlByRows,
SearchDirection:=srcdir, _
MatchCase:=False, SearchFormat:=False).Row
If Err = 0 Then
Range("A" & currdayrow + 1 & ":A" & nextdayrow -
shiftback).Value = days(d)
Exit For
End If
Next nd
End If
Next d
Range("A1").Select
End Sub

Regards,
Stefi


Spiros ezt *rta:

Hi,

I am trying to create a macro that will find the word "MONDAY" in column A,
then copy "MONDAY" (in every cell down to column A) and stop when it will
find the word "TUESDAY" and so on.
Can someone help me with this?
Thanks for your help!!!
Spyros

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
FIND-COPY DIFFERENT WORDS WITH MACRO Spiros Excel Discussion (Misc queries) 1 September 27th 07 11:43 AM
Macro to find matching date and copy values to another sheet Tiger Excel Discussion (Misc queries) 3 August 13th 07 01:45 PM
Macro to find copy "header" and paste RunsWithKnives Excel Discussion (Misc queries) 3 March 27th 06 05:55 AM
Macro to find, copy, and paste until value change Valerie Excel Worksheet Functions 4 January 26th 06 04:10 AM
Need to find the 1st two characters of the 1st two words Tom Excel Worksheet Functions 2 April 21st 05 02:10 AM


All times are GMT +1. The time now is 09:33 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright 2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"