Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8
Default macro problem related with all worksheets

Hi, I have a workbook with a lot of worksheets. I need to write a macro that:
a) takes an input of date in (dd.mm.yyyy) format.
b) takes an input of some txt
c) Search each and every worksheet column F to find that spesific date
d) If such date is present, write the text input to column A at the same row
where the the date has found.
Can anyone help me to solve this problem?
THank you for your help
E.C.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default macro problem related with all worksheets

Try this:-

Alt+F11, insert module and paste it in

Sub versive_Element()
mydate = Range("A1").Value
mytext = Range("A2").Value
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Select
Range("F1:F10").Select
For Each c In Selection
c.Select
If c.Value = mydate Then
ActiveCell.Offset(0, -5).Value = mytext
End If
Next c
Next ws
End Sub

It will pick up the date and text from A1 and A2 on the sheet it is called
from

Mike


"___Zoom" wrote:

Hi, I have a workbook with a lot of worksheets. I need to write a macro that:
a) takes an input of date in (dd.mm.yyyy) format.
b) takes an input of some txt
c) Search each and every worksheet column F to find that spesific date
d) If such date is present, write the text input to column A at the same row
where the the date has found.
Can anyone help me to solve this problem?
THank you for your help
E.C.

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8
Default macro problem related with all worksheets

Thank you Mike...I'll try it and get back to here again to comment.
___Zoom

"Mike H" wrote:

Try this:-

Alt+F11, insert module and paste it in

Sub versive_Element()
mydate = Range("A1").Value
mytext = Range("A2").Value
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Select
Range("F1:F10").Select
For Each c In Selection
c.Select
If c.Value = mydate Then
ActiveCell.Offset(0, -5).Value = mytext
End If
Next c
Next ws
End Sub

It will pick up the date and text from A1 and A2 on the sheet it is called
from

Mike


"___Zoom" wrote:

Hi, I have a workbook with a lot of worksheets. I need to write a macro that:
a) takes an input of date in (dd.mm.yyyy) format.
b) takes an input of some txt
c) Search each and every worksheet column F to find that spesific date
d) If such date is present, write the text input to column A at the same row
where the the date has found.
Can anyone help me to solve this problem?
THank you for your help
E.C.

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8
Default macro problem related with all worksheets

When execute the macro, I received an error message:

Run-time error '1004'
method 'Select' of object'-Worksheet' failed

on the line
ws.Select

What have I done wrong?
___Zoom


"Mike H" wrote:

Try this:-

Alt+F11, insert module and paste it in

Sub versive_Element()
mydate = Range("A1").Value
mytext = Range("A2").Value
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Select
Range("F1:F10").Select
For Each c In Selection
c.Select
If c.Value = mydate Then
ActiveCell.Offset(0, -5).Value = mytext
End If
Next c
Next ws
End Sub

It will pick up the date and text from A1 and A2 on the sheet it is called
from

Mike


"___Zoom" wrote:

Hi, I have a workbook with a lot of worksheets. I need to write a macro that:
a) takes an input of date in (dd.mm.yyyy) format.
b) takes an input of some txt
c) Search each and every worksheet column F to find that spesific date
d) If such date is present, write the text input to column A at the same row
where the the date has found.
Can anyone help me to solve this problem?
THank you for your help
E.C.

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default macro problem related with all worksheets

Hi,

I can't replicate that error but maybe it's to do with where you put the
code. It goes in a workbook module.

Alt + F11 to open VB editor
Right click This Workbook and then insert module
The newly inserted module should be selected
paste the code in exactly as provided.

Call it from a worksheets and it will take A1 & A2 values from that sheet to
use as the sate and text.

Mike

"___Zoom" wrote:

When execute the macro, I received an error message:

Run-time error '1004'
method 'Select' of object'-Worksheet' failed

on the line
ws.Select

What have I done wrong?
___Zoom


"Mike H" wrote:

Try this:-

Alt+F11, insert module and paste it in

Sub versive_Element()
mydate = Range("A1").Value
mytext = Range("A2").Value
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Select
Range("F1:F10").Select
For Each c In Selection
c.Select
If c.Value = mydate Then
ActiveCell.Offset(0, -5).Value = mytext
End If
Next c
Next ws
End Sub

It will pick up the date and text from A1 and A2 on the sheet it is called
from

Mike


"___Zoom" wrote:

Hi, I have a workbook with a lot of worksheets. I need to write a macro that:
a) takes an input of date in (dd.mm.yyyy) format.
b) takes an input of some txt
c) Search each and every worksheet column F to find that spesific date
d) If such date is present, write the text input to column A at the same row
where the the date has found.
Can anyone help me to solve this problem?
THank you for your help
E.C.



  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8
Default macro problem related with all worksheets

Hi Mike,
Done all the things you said but Sorry to say that I get the same error
message.
By te way to call it I just use the module name as:
versive_Element
is that OK?.


"Mike H" wrote:

Hi,

I can't replicate that error but maybe it's to do with where you put the
code. It goes in a workbook module.

Alt + F11 to open VB editor
Right click This Workbook and then insert module
The newly inserted module should be selected
paste the code in exactly as provided.

Call it from a worksheets and it will take A1 & A2 values from that sheet to
use as the sate and text.

Mike

"___Zoom" wrote:

When execute the macro, I received an error message:

Run-time error '1004'
method 'Select' of object'-Worksheet' failed

on the line
ws.Select

What have I done wrong?
___Zoom


"Mike H" wrote:

Try this:-

Alt+F11, insert module and paste it in

Sub versive_Element()
mydate = Range("A1").Value
mytext = Range("A2").Value
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Select
Range("F1:F10").Select
For Each c In Selection
c.Select
If c.Value = mydate Then
ActiveCell.Offset(0, -5).Value = mytext
End If
Next c
Next ws
End Sub

It will pick up the date and text from A1 and A2 on the sheet it is called
from

Mike


"___Zoom" wrote:

Hi, I have a workbook with a lot of worksheets. I need to write a macro that:
a) takes an input of date in (dd.mm.yyyy) format.
b) takes an input of some txt
c) Search each and every worksheet column F to find that spesific date
d) If such date is present, write the text input to column A at the same row
where the the date has found.
Can anyone help me to solve this problem?
THank you for your help
E.C.

  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 162
Default macro problem related with all worksheets

For the first part of your set of questions, you would just need to record
the macro in the macro player and format cells under custom and type in
dd.mm.yyyy. Hope this helps.

Daren

"___Zoom" wrote:

Hi, I have a workbook with a lot of worksheets. I need to write a macro that:
a) takes an input of date in (dd.mm.yyyy) format.
b) takes an input of some txt
c) Search each and every worksheet column F to find that spesific date
d) If such date is present, write the text input to column A at the same row
where the the date has found.
Can anyone help me to solve this problem?
THank you for your help
E.C.

  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8
Default macro problem related with all worksheets

Thanks Daren,


"Daren" wrote:

For the first part of your set of questions, you would just need to record
the macro in the macro player and format cells under custom and type in
dd.mm.yyyy. Hope this helps.

Daren

"___Zoom" wrote:

Hi, I have a workbook with a lot of worksheets. I need to write a macro that:
a) takes an input of date in (dd.mm.yyyy) format.
b) takes an input of some txt
c) Search each and every worksheet column F to find that spesific date
d) If such date is present, write the text input to column A at the same row
where the the date has found.
Can anyone help me to solve this problem?
THank you for your help
E.C.

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
Copying related information between worksheets Ingrid Excel Discussion (Misc queries) 1 October 24th 06 06:43 PM
problem of copying column related to date news Excel Discussion (Misc queries) 3 May 12th 06 10:23 PM
Non-excel related problem about thumbnails conksu Excel Discussion (Misc queries) 2 April 27th 06 10:36 PM
macro related Ankur Excel Discussion (Misc queries) 3 August 17th 05 11:26 AM
New Router, Excel problem.. are they related! gracenote Excel Discussion (Misc queries) 2 July 13th 05 07:26 AM


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