Pasting merged cells using VBA - vba

I'm trying to copy a row of data from an excel sheet and transfer that to another sheet, but the range of row data has a two column merged cell in it and I'm having trouble pasting without any errors.
Any tips would be very helpful,

For copy a merged cells, you need mention range.
Example : A9 and B9 were merged, you need use Range("A9:B9").Copy to copy the merged cell

Related

VBA Vlookup with copy/paste and date/time stamp

first post here and relative newbie to everything VBA!
Ideally, what I am looking for is a macro that will take a value entered into a cell, VLOOKUP against an array on another sheet and paste the value in the next blank cell in that row, with a date/time stamp in the next blank adjacent cell. I'd like to be able to keep the original data so that if the macro runs again it doesn't overwrite any previously pasted data.
For example, the data to copy/paste will be entered into cell D2 on sheet 2, the value to lookup is in B2 on sheet 2. The array to look against is Sheet 6 Column A with columns B and C for the pasted value and date/time stamp respectively.
Any help is greatly appreciated!
Ant.

Copy and Paste to Blank Rows until Blank in Other Column

I am trying to copy and paste A8:P8 in to the Blank Rows (as per pic below) until the data in column Q is blank - is there a VBA which can do this? I need to do this on multiple tabs so the row number will be variable.
Although you could accomplish this with VBA, have you tried just using cell formulae?
For example, in the first empty cell in column A you'd put:
=$A$8
then the same for each other cell in the row, changing the column letter.
Then select all of the cells with formula and double-clicking the autofill handle which will copy the formula down to the last row with data in the adjacent column.

How to select only cells with values on different sheets, without switching over to that sheet?

I currently have a macro that copies and paste data from one sheet to another sheet, based on a certain criteria. I have over 15 sheets that it does this.
Now what I want to do is select all the data in the new sheets, and turn it into a table.
I know I can use ActiveSheet, but I would need to do that for every single sheet. Is there a way I can select only the data in other sheets, without that being my active sheet?
I am able to select all my data in an active sheet with this:
ActiveSheet.Range("B1:M1", ActiveSheet.Range("B1:M1").End(xlDown)).Select
I tried doing something like below, but just selects the last cell with data in it. If I remove the .End(xlDown), then it will select B1:M1.
Application.Goto Sheets("SheetName").Range("B1:M1").End(xlDown)
Any idea if there is a way to copy my data in those ranges without switching tabs?
Thank you!
You can avoid Select/Selection/Active/ActiveXXX, like follows:
With Sheets("SheetName")
.Range("B1:M1", .Range("B1:M1").End(xlDown)).Copy Destination:= someotherrange
End With
Where someotherrange is a valid range reference where to paste copied data into

Copy all non empty cells in a sheet to another sheet in another workbook

I've got two workbooks 1. MonthlyStats and 2. WeeklyStats
I'm looking to copy all non-empty cells there are in 'Sheet1' of 'WeeklyStats' to 'SheetX' of 'MonthlyStats'. The copied data should be inserted as new rows from the last entry in 'SheetX'.
Also, is it possible that the script asks me which row to start inserting data from? That'd be great!
Thanks in advance for your help!
PS:
I'm using Excel 2010
There are no conditions on what to copy from Sheet1 of WeeklyStats. All rows with data in it should be copied over.
I personally find the best way to learn VBA is to search and try different codes in order to solve a problem. For your problem, maybe try read the post here:
Copy and Paste a set range in the next empty row
You can then use For each sheet loop to copy weekly stats from different sheets to the monthly stats sheet. Hope it helps
Regarding the question copy non blank cells, try
Worksheets("Sheet1").Activate
ActiveSheet.UsedRange.Select
Selection.copy

Spliting cells in excel based on some parameter

I wanted to know who can the following content be split in to two cells:
if i have C:\Pgm\Win\a1.c
in one cell
how can i split it in to two cells
C:\Pgm\Win a1.c
In my excel I have around 500 such rows.Is their any key availabe to do. I am using excel 2007.
You can use formulas to do the split
Assuming first string is in cell A1, place these formulas
Cell B1
=LEFT(A1,FIND("*",SUBSTITUTE(A1,"\","*",LEN(A1)-LEN(SUBSTITUTE(A1,"\",""))))-1)
Cell C1
=RIGHT(A1,LEN(A1)-FIND("*",SUBSTITUTE(A1,"\","*",LEN(A1)-LEN(SUBSTITUTE(A1,"\","")))))
Copy down for all data rows
Once these formulas are calculated, you can copy/paste values and delete the original data if required
by using data to columns ....we can get...in to multiple columns...but it will not be an 100% solution