Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 11-02-2011, 07:25 AM
tinfanide tinfanide is offline Excel Table Windows 7 64bit Excel Table Office 2010 32bit
Expert
Excel Table
 
Join Date: Aug 2011
Posts: 312
tinfanide is on a distinguished road
Default Excel Table

I have set a table from Col A to B
Col A contains numbers from 1
I want once I've entered data in B1 and press "Enter"
The table auto opens a new row (Row 2) and in A2
It auto shows the row number (that should be 2) and
This process goes on...

A B
1 1 a
2

I've taken ref from one of the experts's codes here and tried tweaking it a bit but my effort fails.

Code:
Option Explicit

Sub auto_open()
ThisWorkbook.Worksheets("Sheet1").OnEntry = "add"
End Sub

Sub add()
Dim lastrow As Long

With Sheets("Sheet1")
lastrow = Range("A" & Rows.Count).End(xlUp).Row
Cells(lastrow + 1, 1).Value = Cells(lastrow - 1, 1).Value + 1

End Sub
I'm totally green in VBA.


Could anyone help?
Reply With Quote
  #2  
Old 11-02-2011, 07:49 AM
tinfanide tinfanide is offline Excel Table Windows 7 64bit Excel Table Office 2010 32bit
Expert
Excel Table
 
Join Date: Aug 2011
Posts: 312
tinfanide is on a distinguished road
Default

I've sorted it out, not by VBA though.

I type Row() in A1 and the table seems to have filled down the formula and every time I press enter to open a new row, the new row number is returned.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel Table Proper Excel Table of Contents (ToC) judicial85 Excel 1 10-23-2011 01:35 PM
Excel Table Excel 2010 Pivot Table Qs SchneeBaer Excel 2 10-03-2011 08:45 PM
Excel Table How to Convert a Table from PDF to Excel belly Excel 2 09-07-2011 06:26 AM
Excel Table Excel table properties pmblom Excel 4 07-03-2011 02:00 AM
Linking Excel Table to Powerpoint gsteveli PowerPoint 0 05-25-2011 07:50 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:45 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft