Copy only cell value to 1st empty cell in range

nokia447

New Member
Joined
Nov 10, 2021
Messages
3
Office Version
  1. 365
Platform
  1. Windows
In cell C1 I have formula like =CONCATENATE(F1;G1;H1)
I want to have a VBA script that takes the value from C1 and paste the value in A5. Next time I use the macro I want it to paste the value of C1 to the first empty cell in column A.

I have found a script that works for copying if the C1 is a value already, but that script does not work if C1 is a formula reffering to values in other cells....

Current VBA is:
-------------
Sub test1()
Range("C1").copy Destination:=Range("A" & Rows.Count).End(xlUp).Offset(1)
End Sub
-------------
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Try this:
VBA Code:
Sub My_Answer()
'Modified  11/10/2021  9:42:11 PM  EST
Range("A" & Rows.Count).End(xlUp).Offset(1) = Range("C1").Value
End Sub
 
Upvote 0
May have pipped to the post on this however the below will work only if there is a value in cell C1 and will populate cell A5 if it is blank otherwise it will add it to the cell below.


VBA Code:
Sub test1()

If Range("C1").Value = ""  Then

Else
    If Range("A5").Value = "" Then
    
    Range("A5").Value = Range("C1").Value
    
    Else
    
    Range("A" & Rows.Count).End(xlUp).Offset(1) = Range("C1").Value
    
    End If
    
End If

End Sub

Steven
 
Upvote 0
Solution
May have pipped to the post on this however the below will work only if there is a value in cell C1 and will populate cell A5 if it is blank otherwise it will add it to the cell below.


VBA Code:
Sub test1()

If Range("C1").Value = ""  Then

Else
    If Range("A5").Value = "" Then
   
    Range("A5").Value = Range("C1").Value
   
    Else
   
    Range("A" & Rows.Count).End(xlUp).Offset(1) = Range("C1").Value
   
    End If
   
End If

End Sub

Steven
Thank you so much this works good so I used this. :)
 
Upvote 0

Forum statistics

Threads
1,215,734
Messages
6,126,542
Members
449,316
Latest member
sravya

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