VBA CODE -- Find and insert

MichaelJ300

Board Regular
Joined
Oct 30, 2013
Messages
143
Office Version
  1. 2016
Platform
  1. Windows
Hello,

I’m not sure how to explain what I need here…
I need to identify the first blank space then copy and paste information in that area. Then find the second space and copy and paste information in this area.

Step 1: identify the first empty row and copy and paste from a different tab named “Control” cell A21.
Step 2: Identify the second empty row copy and paste from a different tab named “Control” cell A22.

Thanks in advance…
 
Nope this didn't work... maybe it's how I'm puting in the code.
Sheets("TA TOTALS").Select
Cells(1, 1).End(xlDown).Offset(1, 0) = Worksheets("Control").Rows(21).Copy

what if I did this and then merged a:s with bold and color when pasting the data.
Cells(1, 1).End(xlDown).Offset(1, 0) = Worksheets("Control").Cells(21, 1)
 
Upvote 0

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Nope this didn't work... maybe it's how I'm puting in the code.
Sheets("TA TOTALS").Select
Cells(1, 1).End(xlDown).Offset(1, 0) = Worksheets("Control").Rows(21).Copy

what if I did this and then merged a:s with bold and color when pasting the data.
Cells(1, 1).End(xlDown).Offset(1, 0) = Worksheets("Control").Cells(21, 1)

I used this code and it worked with merged cells and color. Now I am using Excel 2013 so that may be a problem as well..

Code:
Sub emptyrow()


    Worksheets("Control").Rows(21).Copy
    Worksheets(1).Cells(1, 1).End(xlDown).Offset(1, 0).PasteSpecial
    
    Worksheets("Control").Rows(22).Copy
    Worksheets(1).Cells(1, 1).End(xlDown).Offset(1, 0).PasteSpecial
    
   Worksheets(1).Activate
End Sub

Another thing you could do, as you said is to merge and color the cell.

Code:
Sub MergeCell()
dim x as long

x = Worksheets(1).Cells(1, 1).End(xlDown).Offset(1, 0).Row
Cells(x,1) = Worksheets("Control").Cells(21,1)
With Range("A" & x & ":S" &x)
       .Merge
       .Font.Bold = True
       .Font.ColorIndex = 3
End With

End Sub

This will turn the font red. You could also use color and the RGB index. To tell what color font the cell is you can click the cell and write the following code --- MsgBox ActiveCell.Font.ColorIndex. If its the interior color than replace Font with interior.
 
Upvote 0

Forum statistics

Threads
1,216,119
Messages
6,128,944
Members
449,480
Latest member
yesitisasport

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