Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 410
Default Merge Macro

Sub Macro6()
Dim row1 As Long
Dim col1 As Long


Set MYrange = Application.InputBox(Prompt:="Please select
range", _
Title:="Tihs Siht Kcuf", Type:=8)
row1 = MYrange.Row
col1 = MYrange.Column


Range(MYrange, Cells(row1, col1 - 1 + Range("P" &
row1))).Select
Selection.Merge
Selection = Range("P" & row1) & "%"
Selection.Interior.ColorIndex = 35

I have been working on this all night and this is the best I can come
up with. I need to merge cells based on what is in P, Q, R, S, and T

So for instance IF Range("P" row1) <0 then
Starting at Range("AA" row1) I want the cells to
merge for the number that is in "P". So if the number is 10 then it
woudl merge cells AA:AJ. Then merge the cells to the right based on
what is in Q. The tricky part is that any of these at anytime can be
0 and I can not think of how to do this.

Thanks,
Jay

Here is all of my code.

Set myrange2 = Cells(row1, col1 + Range("P" & row1))
Range(myrange2, Cells(row1, col1 - 1 + Range("Q" &
row1) + Range("P" & row1))).Select
Selection.Merge
Selection = Range("Q" & row1) & "%"

Range(Cells(row1, col1 + Range("p" & row1) + Range("Q" & row1)),
Cells(row1, _
col1 + Range("P" & row1) + Range("Q" & row1) + Range("R" &
row1))).Select
Selection.Merge
Selection = Range("R" & row1) & "%"
Selection.Interior.ColorIndex = 36

Range(Cells(row1, col1 + Range("p" & row1) + Range("Q" & row1) + _
Range("R" & row1) + 1), Cells(row1, col1 + Range("P" & row1) + _
Range("Q" & row1) + Range("R" & row1) + Range("S" & row1) -
1)).Select

Selection.Merge
Selection = Range("S" & row1) & "%"
Selection.Interior.ColorIndex = 34
 
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
How to merge / combine several worksheets into one new worksheet without VBA / Macro? FOR EXPERTS [email protected] Excel Worksheet Functions 9 August 13th 07 04:19 AM
Merge cells with formula or macro? Joe M. Excel Discussion (Misc queries) 5 July 23rd 07 10:28 PM
merge columns into single report - macro needed aquaflow Excel Discussion (Misc queries) 2 February 5th 07 12:41 PM
Macro to merge open workbooks Barry McConnell Excel Discussion (Misc queries) 1 August 23rd 06 05:09 PM
Mail Merge macro Wonder Women Excel Discussion (Misc queries) 4 January 5th 06 07:37 PM


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