a vba import into merged cell question

John Caines

Well-known Member
Joined
Aug 28, 2006
Messages
1,155
Office Version
  1. 2019
Platform
  1. Windows
Hello All.

I'm just trying to finish off a spreadsheet,, it's 95% done,,, but I really need help with 1 macro to finish it off, as it will be quite code intensive (For me anyway) :-)

I would like to ask 1 question so I can clarify how the macro needs to be written.

My question is;
If for example I have a £ amount in cell K36 of £100, in a sheet called "Data Import"
And would like a macro button, that would export it to another sheet called Daily Targets and insert into Cell J24,,,, this can be easily achieved,,, I think so,, yes,,?

But,,,,,,,,,,,,,,,,
If J24 is a merged across cell,, IE is merged with K24,,, can this still be done in VBA?

Or,,, Does K36 have to be a merged across cell (As I could redo this sheet, so K36 is merged with L36,,,, so a merged cell is exporting to another merged cell?

I ask this because if you usually copy and paste cells into excel, and some are merged,, excel usually says via a pop up that the cell you are importing to is not the same size or shape,, (Or something to that effect) :-)

If somebody could please just clarify this for me,, it would be most helpful,, so I know what I need to do/say regarding the new macro.


many thanks for all your time.

regards
john Caines
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Hi John.

Merged cells are best avoided. It is better to format the cells horizontal alignment as Center across selection.

If you try to copy and paste it will probably fail. However, this should work

Code:
Sheets("Daily Targets").Range("J24").Value = Sheets("Data Import").Range("K36").Value
 
Upvote 0
Many thanks VOG for your reply,,,
i've just tried your suggestion,, but I couldn't get it to work :-(

But,,, from what you have said,, merged cells are best avoided,, so I will redo my sheet before posting,, so I can explain correctly.

As a note,, the macro has to do several functions,,,but my 1st concern was the merged cell issue,, so on your advice I'll redo my sheet so it imports into only NON merged cells.

As a note VOG,, do you use excel 2010?
I didn't see it in your profile?
just wondered.

many thanks VOG,,
I'm redoing my sheet now,,,:-)

All the best VOG
John Caines
 
Upvote 0
Many thanks again VOG,,
I've managed to remove the merged cells,,,,
I just need to configure a few other bits,, then write a detailed post,, as the macro has to do several things,,, never simple with me ! :-)

Again,, many thanks VOG

Regards
JC
 
Upvote 0

Forum statistics

Threads
1,224,502
Messages
6,179,126
Members
452,890
Latest member
Nikhil Ramesh

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top