LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default changing result worksheet of macro


Hi,

I have a macro that, when given a range of cells, it searches through
multiple worksheets to see when those cells are not blank. It then
displays a new worksheet with the results. Here is an example result
worksheet:

Sheet 1:
Cell 1
Cell 5

Sheet 2
Cell 3
Cell 4

Sheet 3
Cell 1

etc...

The problem I am having is that when I have a range that contains
multiple columns, I would like the result worksheet to look like this:
(range: D1:E9)

Sheet 1
Cell 1
Cell 3

Sheet 1
Cell 1
Cell 2

Sheet 2
Cell 5
Cell 9

Sheet 2
Cell 4
Cell 6

etc...

(So for each column, there is a new sheetname for the results to be
under)
The way I have the macro written however, it does not do this. My
macro's result would look like this:

Sheet 1
Cell 1
Cell 1
Cell 2
Cell 3

Sheet 2
Cell 4
Cell 5
Cell 6
Cell 9

I cannot think of how to change my macro to make it the way I would
like it. If you have any suggestions please respond. Here is my macro
so you can see what it looks like:

-Sub PeopleSearch()
Dim W As Worksheet
Dim range_input, e_range As Range
Dim VAL, sh_skip, temp As Variant
sh_skip = "Summary" 'sheetname to skip
VAL = InputBox("Enter which range to search in: (ex. D9:D62)")
Set range_input = Range(VAL)
FOR EACH W IN WORKSHEETS
W.SELECT
IF W.NAME < \"SUMMARY\" THEN
TEMP = TEMP & CHR(10) & W.NAME & CHR(10)
END IF

FOR EACH E_RANGE IN RANGE_INPUT
IF W.NAME < SH_SKIP THEN

IF TRIM(W.RANGE(E_RANGE.ADDRESS).VALUE) < \"\" AND
TRIM(W.RANGE(E_RANGE.ADDRESS).VALUE) < \"0\" THEN
TEMP = TEMP & W.RANGE(\"B\" & E_RANGE.ROW).VALUE & CHR(10)

END IF
END IF
NEXT
NEXT
Workbooks.Add
Range("a1").Select
Selection.Value = "CURRENT PROJECTS LIST"
Selection.Font.Bold = True
temp1 = Split(temp, Chr(10))
Range("a2").Select
For i = 0 To UBound(temp1)
Selection.Value = temp1(i)
If ActiveCell.Characters.Count 13 Or Not only_text(ActiveCell) Or
ActiveCell.Value = "RM UCONN SFA" Then
ActiveCell.Font.Bold = True
End If
ActiveCell.Offset(1, 0).Select
Next
Application.DisplayAlerts = False

ActiveWorkbook.SaveAs Filename:= _
"blah", _
FileFormat:=xlNormal, _
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False
ActiveWorkbook.Save
ActiveWorkbook.Close
Application.DisplayAlerts = True
Workbooks.OpenText Filename:="blah"
End Sub-


--
thephoenix12
------------------------------------------------------------------------
thephoenix12's Profile: http://www.excelforum.com/member.php...o&userid=24336
View this thread: http://www.excelforum.com/showthread...hreadid=385231

 
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
Changing result color Gene L. New Users to Excel 2 October 16th 09 05:12 AM
Changing the result of a formula to a real number. coldindetroit Excel Worksheet Functions 2 January 15th 09 09:41 PM
changing formulas to their result values eejitrecords Excel Discussion (Misc queries) 1 August 19th 08 02:17 PM
Changing a cell value in a spreadsheet may not change the result. JAYH33 Excel Discussion (Misc queries) 1 December 5th 07 08:10 PM
trending data from a csv file with one macro with changing worksheet name. Ray Morton[_2_] Excel Programming 1 October 18th 03 02:59 PM


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