VB Cell Recording

mickh95

New Member
Joined
Jun 7, 2021
Messages
4
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Morning,

I'm trying to record a value from a cell (4,5)

As I've created macro buttons that increase and decrease the value, the overall plan is to have a limit on those buttons too, however i want to create a record Button for the time being, and try figure out the later myself.

Script so far;

Sub Higher()

Cells(4, 5).Value = Cells(4, 5).Value + 1

End Sub

Sub Lower()

Cells(4, 5).Value = Cells(4, 5).Value - 1

End Sub

Any help on how to do record the value on cell 4,5 and input them into a table on cells (14,5)?
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Simple...
VBA Code:
Cells(14, 5).Value = Cells(4, 5).Value
Trixterz, Thanks for the reply. it worked perfectly.

however I may have missed some information off, I was wanting to feed the information down a table. so I've tried to incorporate a loop of the cell that would feed down. however ran into some issues;

any further assistance would be great

Sub Higher()

Cells(4, 5).Value = Cells(4, 5).Value + 1

End Sub

Sub Lower()

Cells(4, 5).Value = Cells(4, 5).Value - 1

End Sub

Sub RecordCell()
Dim i As Integer

Do While Cells(14 + i, 5) <> ""

i = i + 1
Loop

With Cells(14 + i, 5)

.Value = Now

Cells(14, 5).Value = Cells(4, 5).Value

End Sub
 
Upvote 0
MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in

It may be easier to explain what you need by creating a "before" and "after" and posting screenshots, but as a guess try:
VBA Code:
Sub Macro1()

    Cells(Rows.Count, 5).End(xlUp).Offset(1).Value = Now
    Cells(14, 5).Value = Cells(4, 5).Value
    
End Sub
 
Upvote 0
I see a few errors in your RecordCell...
VBA Code:
Sub RecordCell()
    Dim i As Integer
    i = 0
    
    Do While Cells(14 + i, 5) <> ""
        i = i + 1
    Loop
    
    Cells(14 + i, 5) = Now
    Cells(14, 5).Value = Cells(4, 5).Value
End Sub

I don't know what your trying to do here so i'm not able to help you out.
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,327
Members
452,635
Latest member
laura12345

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