Excel Macro

Solved/Closed
Macro Newbie - Jan 19, 2012 at 03:23 AM
 MacroNewbie - Feb 16, 2012 at 02:35 AM
Hello,

I wonder if anyone can help me with a small (I think) problem, please?

I'm trying to write a macro to manipulate a spreadsheet sent to me by an external source. It contains a list of transactions with a summary below.
In order to format the summary in the way I want, I need to unmerge the cells it appears in.

I'm trying to put in something like:

x = InputBox("How many transactions?")
Rows("(x+12):(x+12)").Select
Selection.UnMerge

but it's not working.

Many thanks for anyone's suggestions on how I could do this instead,
A Macro Newbie.

Related:

1 response

TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 555
Jan 19, 2012 at 10:33 AM
Hello Macro Newbie,

Your problem is this line:
Rows("(x+12):(x+12)").Select 
Change it into this:
Rows(x + 12).Select
Best regards,
Trowa
0
Thanks so much for this.
It's now stalling at a similar line:
Range("a(x+12):q(x+12)").Select
Selection.Merge
where I am trying to merge columns A to Q on my row (x+12). Is there another way to describe this range?
Many thanks in advance for anyone's help on this again.
Regards.
0
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 555
Feb 13, 2012 at 10:06 AM
To correct your line:
Range("A" & (x + 12) & ":Q" & (x + 12)).Select

I personally would use:
Range(Cells(x + 12, "A"), Cells(x + 12, "Q")).Select

Best regards,
Trowa
0
Thank You. I've got it going now :o)
0