Copy data to new Row - VBA

Cred69

New Member
Joined
Jan 8, 2015
Messages
20
My skills with VBA hasn't been used in many, many, years now, so I am totally lost on this project that I am doing. I know my VBA code is rudimentary and there are far better ways to do this than what I have done so far. So please don't flame me too bad on this :).

I have managed to get what code I have put together thus far to do what I want it to do. However now I need it to do something I have not been able to search and find. I want to take the data that I am programming into my spreadsheet (right side) See image below, to be entered onto the next row (on the left side) while also coping a couple of cells that have "if statements" built into the cell (because I couldn't figure out how to do it in VBA)
view
and do this every time I click the button. The Yellow and Gray color cells are the cells that I would like to copy to the next line.

https://drive.google.com/file/d/0B-IqYSGZJ5-4UkYtT21vOUhpbW8/view?usp=sharing

How would you write the code to make this work?
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Hia
How about
Code:
    Dim NxtRw As Long
    
    NxtRw = Range("A" & Rows.Count).End(xlUp).Offset(1).Row
    [COLOR=#ff0000]Range("T3").Copy Range("B" & NxtRw)
[/COLOR]

    [COLOR=#0000ff]Range("F" & NxtRw - 1 & ":G" & NxtRw).FillDown[/COLOR]
You'll need to change the rest of your code to match the line in red.
The line in blue will copy F&G down 1 row
 
Upvote 0
That worked great - Thank you! :biggrin:

One last question. "Range("F" & NxtRw - 1 & ":G" & NxtRw).FillDown"

How do you add more cells to this string when they are not next to each other?
 
Upvote 0
Not sure you can, but that line is a bit of a mess.
This will do the same & will also do col K as well
Code:
    Range("F" & NxtRw - 1).Resize(2, 2).FillDown
    Range("K" & NxtRw - 1).Resize(2).FillDown
 
Upvote 0
Glad to help & thanks for the feedback
 
Upvote 0
Fluff,

Sorry to bring this back up, but I just realized a problem with my code. If I make more than one line at a time some of the data is changing to match the latest row I just made. Is there anyway with the code I have to just paste the values?


Code:
Dim NxtRw As Long
    
    NxtRw = Range("A" & Rows.Count).End(xlUp).Offset(1).Row
    Range("AD6").Copy Range("B" & NxtRw)
    Range("AE6").Copy Range("F" & NxtRw)
    Range("AF6").Copy Range("K" & NxtRw)
    Range("AG6").Copy Range("AA" & NxtRw)
    Range("AH6").Copy Range("L" & NxtRw)
    Range("AI6").Copy Range("M" & NxtRw)
    Range("AK6").Copy Range("N" & NxtRw)
    
    Range("AC9").Copy Range("T" & NxtRw)
    Range("AC10").Copy Range("S" & NxtRw)
    Range("AC11").Copy Range("A" & NxtRw)
    Range("AC12").Copy Range("U" & NxtRw)
    Range("AC13").Copy Range("V" & NxtRw)
    
    
    Range("C" & NxtRw - 1 & ":E" & NxtRw).FillDown
    Range("G" & NxtRw - 1 & ":J" & NxtRw).FillDown
    'Range("L" & NxtRw - 1 & ":M" & NxtRw).FillDown
    Range("O" & NxtRw - 1 & ":R" & NxtRw).FillDown
    Range("W" & NxtRw - 1 & ":Z" & NxtRw).FillDown
End Sub

I can add .PasteSpecial at the end, but adding PasteValue causes it to fail and just having .PasteSpecial fails as well. What am I missing?

Thanks,
Scott
 
Upvote 0
I'm afraid I don't understand.
If I make more than one line at a time
This code is only adding 1 line.


Is there anyway with the code I have to just paste the values?
Which values? All of them or just some?
 
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,306
Members
452,633
Latest member
DougMo

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