Forum Discussion
dlav2001
Dec 06, 2020Copper Contributor
Creating an excel Database from input on Row one
I an trying to create a database that has 8 columns of data. The complicated part is, I want to enter the data on line 1 ONLY ( the first 5 columns of line 1) , and have it add to an ongoing data...
HansVogelaar
Dec 06, 2020MVP
See the attached version (now a .xlsm workbook since it contains VBA code).
- dlav2001Dec 08, 2020Copper Contributor
HansVogelaar that is Excellent, That is 99% of what I wanted. I was hoping to do it without the Add record button but that is not the end of the world.
It works exactly as designed for a Computer, however VBA will not run on my Excel on my Cell phone. which is what I had originally intended.
but this is perfect. If only I can figure out how you did it.
- HansVogelaarDec 08, 2020MVP
I don't think it's possible to do what you want without VBA code, so it will only work on Windows and MacOS, not on Android or iOS.
The command button runs the following macro when clicked:
Sub AddRecord() Dim d As Long Dim m As Long Dim r As Long If Range("B14").Value = "" Then Range("B14").Select MsgBox "Please enter the bus number!", vbExclamation Exit Sub End If m = Range("C13").End(xlUp).Row - 2 If m = 0 Then Range("C3").Select MsgBox "Please enter information in rows 3 and below!", vbExclamation Exit Sub End If d = Val(Range("C14").Value) If d < 1 Or d > m Then Range("C14").Select MsgBox "Please enter a valid day!", vbExclamation Exit Sub End If r = Cells.Find(What:="*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row + 1 Range("A" & r).Resize(1, 10).Value = Range("A14").Resize(1, 10).Value Range("B14:C14").ClearContents Range("B14").Select End SubYou can view the code by activating the Visual Basic Editor (press Alt+F11) and opening Module1 under Modules.
- dlav2001Dec 12, 2020Copper Contributor