Forum Discussion
doomiloom1
Apr 28, 2019Copper Contributor
mark the whole next column when i press enter (using macro?)
hi everyone i have a file that i'm working on everyday it has about 40 columns, and everyday i have to give unique 'table' names to every column, and everyday the names are different so i cant use...
JKPieterse
Apr 29, 2019Silver Contributor
doomiloom1 Perhaps this little macro helps?
Option Explicit
Sub RenameAllTables()
Dim sNewName As String
Dim oLo As ListObject
For Each oLo In ActiveSheet.ListObjects
Application.Goto oLo.Range.Cells(1, 1)
sNewName = ""
sNewName = InputBox("Please enter the new name for this table", "New table name", oLo.Name)
If Len(sNewName) > 0 Then
oLo.Name = sNewName
End If
Next
End Sub
doomiloom1
Apr 29, 2019Copper Contributor
thanks for the response
tried it
it doesn't seem to do anything ? .. ?
i enabled marcos and everything.
still nothing really happens when i "run" it
my main goal is when i press "enter" - excel will automatically mark the next column, for example - B:B and will go to the "table name" area, then ill put the name and press "enter" again and everything keeps going, until i decide to just stop the macro
- JKPieterseApr 30, 2019Silver ContributorThe code assumes you already have tables and just have to rename them, that is what I understood form your question. If not, Why are you creating a table for columns which are next to each other? that is poor design and can lead to confusion. I always have at least one empty column between two tables.