Find next blank line then paste data

tynawg

New Member
Joined
Oct 11, 2019
Messages
42
Hi,
On the Service Order tab (Link below) there is a button that runs a macro to extract certain data form the Service Order form then paste to the imported Data sheet.
How can I continue to add different but new data below the last pasted entry in the Imported Data sheet? Code to find next blank row?
Regards,
Wayne


VOID VALIDATION KC.xlsm
 
Thanks Mark858,
It does not address the boolean or colnr but thank you for taking the time to reply.
Regards,
Wayne
 
Upvote 0

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
What Boolean? colnr just replaces the column letter.
 
Upvote 0
Hi Mark858,

At the moment If IsNumeric line is looking for the cell that has the text and it is also hard coded to A1, then R16 to A2, then the range is below those 2.

I don't understand where or how to incorporate your suggestions, sorry. Otherwise I probably wouldn't need to post here.
Regards,
Wayne

Code:
    Dim celA As Range, celB As Range, cel As Range
    Set ws1 = Sheets("ServiceOrder")
    Set ws2 = Sheets("Imported data")
    Set cel = ws2.Range("A1")
    Set celA = ws1.Range("BL3")
    Set celB = ws1.Range("BK3")
 
    If IsNumeric(celA) And celA <> "" Then cel = celA Else cel = celB
 
Upvote 0
I am afraid at the moment I am not understanding what you are trying to do.
Please explain in words (without referring to the code that isn't doing what you want) what you are trying to do.
 
Upvote 0
So, I have a situation where client sends work orders in a merged cell format. I am trying to create a macro to extract certain cells and a range of cells and copy them below the last work order on the Import data sheet. (Have not figured out how to import that merged data to run macro on yet)
A1 is the work order number in ws2.
A2 is the job address in ws2..
A3 is the range of Item codes issued to this work order in ws2.
I want to extract 3 sets of data in that sequence and copy/paste to next blank row. Then I will advance to my next question.
However recently I found the WO changes sometimes and the data that was in cell BL3 changed to BK3 hence trying to find which cell has the work order number in it to then copy.
Regards,
Wayne
 
Upvote 0
Must be me tonight but none the wiser so rather than use a lastrow variable I will try and show how to post to the next blank row on an individual column so....

For column E...

Code:
    Range(Cells(40, colnr), Cells(lastrow, colnr)).Copy ws2.Cells(Rows.count, "[COLOR="#FF0000"][B]E[/B][/COLOR]").End(xlUp)(2)
or for column B
Code:
    Range(Cells(40, colnr), Cells(lastrow, colnr)).Copy ws2.Cells(Rows.count, "[COLOR="#FF0000"][B]B[/B][/COLOR]").End(xlUp)(2)

If it makes more sense to you then you can replace the (2) with .Offset(1, 0) i.e.
Code:
Range(Cells(40, colnr), Cells(lastrow, colnr)).Copy ws2.Cells(Rows.count, "B").End(xlUp)[COLOR="#FF0000"][B].Offset(1, 0)[/B][/COLOR]
 
Upvote 0
Perhaps if I post a link to the workbook it might be easier to see what I am on about or trying to do?
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,175
Members
453,021
Latest member
Justyna P

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