#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Find cell

I have a spreadsheet that is filled with data quarterly.

I think I want to have the macro look for Q1, which would be via an input
box, find Q1 and begin entering the data from that point on. Any suggestions?


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Find cell

Hi

You don't mean you have allocated some rows for q1,q2,q3,q4 ,do you?
What is the display of your sheet ? Pls give us some more details.
Otherwise you can always use excel built in "find" which is the
fastest method.

rgds

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 73
Default Find cell

On Mar 19, 1:01 pm, Clarissa
wrote:
I have a spreadsheet that is filled with data quarterly.

I think I want to have the macro look for Q1, which would be via an input
box, find Q1 and begin entering the data from that point on. Any suggestions?


Clarissa,

You can do something similar to the following:

Option Explicit

Sub findQ1()

Dim response

response = InputBox("Input the corresponding quarter","Q?","Q1")
'note: you'll probably want to validate that the input text is
''Q1, Q2, Q3, or Q4.

Cells.Find(What:=response).Activate
'Find has a lot more parameters than just "What"

'then once the cell is found you can output the values by using
something
'like ActiveCell.Offset(row,col).Value = .....

End Sub

As a side note, look up the "Find" and "Search" functions in the Excel
help.

Matt

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Find cell

Thanks Matt,

This was helpful.

As I said the report is run quarterly, i.e. March, June, September and
December.

The report has 23 spreadsheets for each division, so the "response" will
work magnificently until the macro gets too large and then I'll have to call
another macro to run similarly for the remainder of the divisions, the user
will then have to input the current quarter again.

Is there a way, for example, that I can add an IF - like if current month =
"March" look for Q1 and so forth? Thank you



"matt" wrote:

On Mar 19, 1:01 pm, Clarissa
wrote:
I have a spreadsheet that is filled with data quarterly.

I think I want to have the macro look for Q1, which would be via an input
box, find Q1 and begin entering the data from that point on. Any suggestions?


Clarissa,

You can do something similar to the following:

Option Explicit

Sub findQ1()

Dim response

response = InputBox("Input the corresponding quarter","Q?","Q1")
'note: you'll probably want to validate that the input text is
''Q1, Q2, Q3, or Q4.

Cells.Find(What:=response).Activate
'Find has a lot more parameters than just "What"

'then once the cell is found you can output the values by using
something
'like ActiveCell.Offset(row,col).Value = .....

End Sub

As a side note, look up the "Find" and "Search" functions in the Excel
help.

Matt


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 73
Default Find cell

On Mar 20, 12:00 pm, Clarissa
wrote:
Thanks Matt,

This was helpful.

As I said the report is run quarterly, i.e. March, June, September and
December.

The report has 23 spreadsheets for each division, so the "response" will
work magnificently until the macro gets too large and then I'll have to call
another macro to run similarly for the remainder of the divisions, the user
will then have to input the current quarter again.

Is there a way, for example, that I can add an IF - like if current month =
"March" look for Q1 and so forth? Thank you



"matt" wrote:
On Mar 19, 1:01 pm, Clarissa
wrote:
I have a spreadsheet that is filled with data quarterly.


I think I want to have the macro look for Q1, which would be via an input
box, find Q1 and begin entering the data from that point on. Any suggestions?


Clarissa,


You can do something similar to the following:


Option Explicit


Sub findQ1()


Dim response


response = InputBox("Input the corresponding quarter","Q?","Q1")
'note: you'll probably want to validate that the input text is
''Q1, Q2, Q3, or Q4.


Cells.Find(What:=response).Activate
'Find has a lot more parameters than just "What"


'then once the cell is found you can output the values by using
something
'like ActiveCell.Offset(row,col).Value = .....


End Sub


As a side note, look up the "Find" and "Search" functions in the Excel
help.


Matt- Hide quoted text -


- Show quoted text -


Clarissa,

In the VBE Help section, search "Select Case Statement" and
"If...Then...Else Statement," and you should find what you need. In
short, if you pull the current month in (whether from the ActiveCell
or from an InputBox), you can run the value through a Case Statement
to output what you want. The following should help lead you in the
right direction. By the way, I'm not sure what you mean by "...until
the macro gets too large..." (Don't discount the ability of Excel).

If the quarter END is Mar, Jun, Sep, and Dec (i.e. the fiscal year end
is Dec).

Option Explicit

Sub findQuarters()

Dim response
Dim findTxt
Dim monthDate

monthDate = Format(DateSerial(Year(Date), Month(Date), Day(Date)),
"mmmm")

response = InputBox("Input the current month","Current
Month",monthDate)
'note: you'll probably want to validate that the input text is valid

Select Case response
Case "January"
findTxt = "Q1"
Case "February"
findTxt = "Q1"
Case "March"
findTxt = "Q1"
Case "April"
findTxt = "Q2"
Case "May"
findTxt = "Q2"
Case "June"
findTxt = "Q2"
Case "July"
findTxt = "Q3"
Case "August"
findTxt = "Q3"
Case "September"
findTxt = "Q3"
Case "October"
findTxt = "Q4"
Case "November"
findTxt = "Q4"
Case "December"
findTxt = "Q4"
End Select

Cells.Find(What:=findTxt).Activate
'Find has a lot more parameters than just "What"
''Also, keep in mind that you need to code something that
''will work if "findTxt" is Nothing.

'then once the cell is found you can output the values by using
something
'like ActiveCell.Offset(row,col).Value = .....

End Sub





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 & Replace: find part cell, replace whole cell katy Excel Worksheet Functions 3 April 3rd 23 01:20 PM
find first empty cell in column and start transpose next row in that cell ali Excel Discussion (Misc queries) 6 July 21st 07 11:55 PM
Find First Non blank cell than find column header and return that value Silver Rose Excel Worksheet Functions 10 April 30th 07 05:56 PM
UDF code to find specific text in cell comments, then average cell values bruch04 Excel Programming 3 December 5th 05 10:01 PM
use find twice to find cell on a specific row captbluefin[_6_] Excel Programming 2 November 1st 03 08:22 PM


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

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"