Attach an example workbook and I'll take a look.
Posts by royUK
-
-
Well that should be loaded from the database. You need to plan the project properly.
-
Why? What is the list supposed to contain.
-
What is UniqueReq?
-
I've looked at your code and I would re-write most of it. Your are using Tables but the code is not specifically written for Tables.
You a UserForm to add a PO number but then use a different form to add parts, I don't understand what you are doing.
I have amended the code in the AddPO form to work properly with a Table.
-
Cross-posting is when you post the same question in other forums on the web. You'll find people are disinclined to respond to cross-posts because they may be wasting their time solving a problem that has been solved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the URL from the address bar in your browser) to the cross-post. We are here to help so help us help you!
Read this to understand why we ask you to do this
-
Check what wsc in wsc.name refers to
-
I doubt if you can with Excel
-
I don't think that code that errors is mine. It looks like you are working with a Table so you don't need to be using any code to find the row to post to.
Where's the original question? Does it have an example workbook?
Also, if your workbook is so big it might be a problem. What is the actual size of it?
-
How are you saving them?
-
Try zipping the file before attaching, although the size of the file might be causing the problem
-
-
It's poor workbook design to have data separated on different sheets.
Your code will only work on the ActiveSheet and on the specified range, if a Table already exists there you will get that error message.
You need to loop through the sheets check if a Table exists and create the Table if not.
Code
Display MoreSub CreateTables() Dim oTbl As ListObject Dim oWs As Worksheet ''///Loop through each sheet and table in the workbook For Each oWs In ThisWorkbook.Worksheets ''///check if A1 is part of a Table If Not TypeName(oWs.Cells(1, 1).Parent) = "Listobject" Then ''///if not convert to Table and name using sheet index oWs.ListObjects.Add(xlSrcRange, oWs.Cells(1, 1).CurrentRegion, , xlYes).Name _ = "Table" & oWs.Index oWs.ListObjects("Table" & oWs.Index).TableStyle = "TableStyleMedium6" End If Next oWs End Sub
-
-
Welcome to the Forum. Please read the Forum Rules to understand how the Forum works and why I have added Code Tags to your post
All VBA code posted in the forum must be wrapped in code tags, which you omitted, including single-line code snippets.Be sure to use them in future posts.
How to use code tags
Just highlight all of the code and press the <> in the post menu above button to add the code tags.
Also, please start your own post. Posting in another member's Thread is known as hijacking and is not allowed here. By all means add a link to a Thread that may be related to your question.
-
Have you read the article or even my comments about data not having empty columns
-
Try this
Code
Display MorePrivate Sub Worksheet_Change(ByVal Target As Range) On Error Resume Next With Target If .CountLarge > 1 Or .Column <> 15 Then Exit Sub .ClearComments On Error GoTo 0 .AddComment .Comment.Text Text:="Modified on: " & Format(Date, "long date") .Comment.Visible = False End With End Sub
-
Add the date into a cell comment like this
CodeSub DateModified() On Error Resume Next With ActiveCell .ClearComments On Error GoTo 0 .AddComment .Comment.Text Text:="Modified on: " & Format(Date, "long date") .Comment.Visible = False End With End Sub
If you want it to be automatic then you could use a worksheet event
Code
Display MorePrivate Sub Worksheet_Change(ByVal Target As Range) On Error Resume Next With Target If .CountLarge > 1 Then Exit Sub .ClearComments On Error GoTo 0 .AddComment .Comment.Text Text:="Modified on: " & Format(Date, "long date") .Comment.Visible = False End With End Sub
If you aren't sure how to use event code then read this
-
That is just making work. Then create reports from the data
-
You need to check if the sheet name exists before running the code.
Why would you want to copy the activesheet, it might not be the correct one? I would have hidden template sheet to copy.
Don't use an error handler until you know the code is working correctly.
Your error handler is all wrong and will run whether an error occurs or not.
Code
Display MoreSub CopyMyWorkSheet() Dim sNm As String sNm = "MyWorkSheet " & Format(DateAdd("m", 1, [E3].Value), "mm-dd-yy") If Not WksExists(wsc.Name) Then ThisWorkbook.Unprotected "Password”" ActiveSheet.Copy ActiveSheet.Name = sNm ThisWorkbook.Protect”Password” Else: Exit Sub End If End Sub ''///place this code in a separate module Function WksExists(wksName As String) As Boolean On Error Resume Next WksExists = CBool(Len(Worksheets(wksName).Name) > 0) End Function