Solved

Arrange description with other options

Posted on 2016-08-30
14
43 Views
Last Modified: 2016-09-01
Hello Experts Exhange community, i am trying to make three other buttons to function with this userform code.

When i click on the userform button ("HOLD" - " ZCOMPLETED" or "AUTO ARRANGE") button make the exixting description on those column replaced with those on button description then search for other row that has the same task with folder name and automatically change those as well.

make the exixting description on those column replaced with those on button description then search for other row that has the same task with folder name and automatically change those as well.
***Change cells with "HOLD --"
***Change cells with "ZCOMPLETED --"
***Change cells with (AUTO ARRANGE #)

Fyi: the actual userform works the only additions will be these three button to have same concept as the actual userform.

images and code with better description is underneath this line, Thanks again Experts Exchange community.

Number-Arange-With-Options.pngNumber-Arange-with-options-2.pngNumber-Arange-with-options-3.pngNumber-Arange-with-options-4.png
Sub openuserform()
NumberArange.Show
End Sub

Private Sub CommandButton1_Click()
NumberArange.MyNumber.Caption = NumberArange.MyNumber.Caption + 1

End Sub

Private Sub CommandButton2_Click()
NumberArange.MyNumber.Caption = NumberArange.MyNumber.Caption - 1
End Sub



Private Sub CommandButton3_Click()
Dim iRow As Long
Dim ws As Worksheet
Dim rw As Range
Set ws = Worksheets("GENERAL")

For Each rw In ActiveSheet.UsedRange.Rows
If rw.Cells(1, 5) = Label3.Caption And rw.Cells(1, 4) = Label4.Caption Then
rw.Cells(1, 6) = MyNumber.Caption & Right(rw.Cells(1, 6), Len(rw.Cells(1, 6)) - InStr(ActiveCell.EntireRow.Cells(1, 6), " ") + 1)
End If
Next rw

MsgBox "Data added", vbOKOnly + vbInformation, "Data Added"
'clear the data
End Sub

Private Sub CommandButton4_Click()
Unload Me
End Sub




Private Sub CommandButton6_Click()

End Sub

Private Sub UserForm_Activate()
If ActiveCell.EntireRow.Cells(1, 6) <> "" Then MyNumber.Caption = Left(ActiveCell.EntireRow.Cells(1, 6), InStr(ActiveCell.EntireRow.Cells(1, 6), " ") - 1)
If ActiveCell.EntireRow.Cells(1, 5) <> "" Then Label3.Caption = ActiveCell.EntireRow.Cells(1, 5)
If ActiveCell.EntireRow.Cells(1, 4) <> "" Then Label4.Caption = ActiveCell.EntireRow.Cells(1, 4)

End Sub

Open in new window

0
Comment
Question by:Omar Hernandez
  • 7
  • 7
14 Comments
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 41777375
Excel file?
0
 

Author Comment

by:Omar Hernandez
ID: 41777381
forgot about this part. Here you go is with this comment.
completed-8-29-22.xlsm
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 41779265
Sub openuserform()
NumberArange.Show
End Sub

Private Sub CommandButton1_Click()
NumberArange.MyNumber.Caption = NumberArange.MyNumber.Caption + 1

End Sub

Private Sub CommandButton2_Click()
NumberArange.MyNumber.Caption = NumberArange.MyNumber.Caption - 1
End Sub



Private Sub CommandButton3_Click()
Dim iRow As Long
Dim ws As Worksheet
Dim rw As Range
Set ws = Worksheets("GENERAL")

For Each rw In ActiveSheet.UsedRange.Rows
If rw.Cells(1, 5) = Label3.Caption And rw.Cells(1, 4) = Label4.Caption Then
rw.Cells(1, 6) = MyNumber.Caption & Right(rw.Cells(1, 6), Len(rw.Cells(1, 6)) - InStr(ActiveCell.EntireRow.Cells(1, 6), " ") + 1)
End If
Next rw

MsgBox "Data added", vbOKOnly + vbInformation, "Data Added"
'clear the data
End Sub

Private Sub CommandButton4_Click()
Unload Me
End Sub




Private Sub CommandButton5_Click()
Dim rw As Range
Dim mx As Integer
Dim lft As String
mx = 0
For Each rw In ActiveSheet.UsedRange.Rows
If InStr(rw.Cells(1, 6), " ") > 0 Then
lft = Left(rw.Cells(1, 6), InStr(rw.Cells(1, 6), " ") - 1)
If IsNumeric(lft) Then
If Val(lft) > mx Then mx = Val(lft)
End If
End If
Next rw
MyNumber.Caption = mx + 1
End Sub

Private Sub CommandButton6_Click()
    MyNumber.Caption = CommandButton6.Caption
End Sub

Private Sub CommandButton7_Click()
    MyNumber.Caption = CommandButton7.Caption
End Sub

Private Sub MyNumber_Click()

End Sub

Private Sub UserForm_Activate()
If ActiveCell.EntireRow.Cells(1, 6) <> "" Then MyNumber.Caption = Left(ActiveCell.EntireRow.Cells(1, 6), InStr(ActiveCell.EntireRow.Cells(1, 6), " ") - 1)
If ActiveCell.EntireRow.Cells(1, 5) <> "" Then Label3.Caption = ActiveCell.EntireRow.Cells(1, 5)
If ActiveCell.EntireRow.Cells(1, 4) <> "" Then Label4.Caption = ActiveCell.EntireRow.Cells(1, 4)

End Sub

Open in new window

0
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 

Author Comment

by:Omar Hernandez
ID: 41779281
Hello there Saqib, thanks for your response.

The number works perfectly if i am changing numbers to numbers, but when i
***click on a number and try to change it to "HOLD" or "ZCOMPLETED" it gives me a run time error
***Also when i click on Auto arrange if i click on it and the last number was 9 that was assaign to a column, once i delete numbers pertaining to that column and i then go to a task and click on the AUTO ARRANGE button, there not being no numbers it still continue where it last ended and go on from 10 on. Instead of checking for what is the last number in that column and continue from what ever is the last number in that column.
---For example greatest number in that column is 6 if i hit on auto arrange it will show 7.
Back to back example.
---For example greatest number in that column is 3 if i hit on auto arrange it will show 4. and so on

Fyi: if the "--" that pertain to the six column is problematic i would not mind if you have it
 "2"       "HOLD"      "ZCOMPLETED"
instead of having
"2--"      "HOLD --"    "ZCOMPLETED"

error.png
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 41779294
try
Sub openuserform()
NumberArange.Show
End Sub

Private Sub CommandButton1_Click()
NumberArange.MyNumber.Caption = NumberArange.MyNumber.Caption + 1

End Sub

Private Sub CommandButton2_Click()
NumberArange.MyNumber.Caption = NumberArange.MyNumber.Caption - 1
End Sub



Private Sub CommandButton3_Click()
Dim iRow As Long
Dim ws As Worksheet
Dim rw As Range
Set ws = Worksheets("GENERAL")

For Each rw In ActiveSheet.UsedRange.Rows
If rw.Cells(1, 5) = Label3.Caption And rw.Cells(1, 4) = Label4.Caption Then
rw.Cells(1, 6) = MyNumber.Caption & Right(rw.Cells(1, 6), Len(rw.Cells(1, 6)) - InStr(rw.Cells(1, 6), " ") + 1)
End If
Next rw

MsgBox "Data added", vbOKOnly + vbInformation, "Data Added"
'clear the data
End Sub

Private Sub CommandButton4_Click()
Unload Me
End Sub




Private Sub CommandButton5_Click()
Dim rw As Range
Dim mx As Integer
Dim lft As String
mx = 0
For Each rw In ActiveSheet.UsedRange.Rows
If InStr(rw.Cells(1, 6), " ") > 0 Then
lft = Left(rw.Cells(1, 6), InStr(rw.Cells(1, 6), " ") - 1)
If IsNumeric(lft) Then
If Val(lft) > mx Then mx = Val(lft)
End If
End If
Next rw
MyNumber.Caption = mx + 1
End Sub

Private Sub CommandButton6_Click()
    MyNumber.Caption = CommandButton6.Caption
End Sub

Private Sub CommandButton7_Click()
    MyNumber.Caption = CommandButton7.Caption
End Sub

Private Sub MyNumber_Click()

End Sub

Private Sub UserForm_Activate()
If ActiveCell.EntireRow.Cells(1, 6) <> "" Then MyNumber.Caption = Left(ActiveCell.EntireRow.Cells(1, 6), InStr(ActiveCell.EntireRow.Cells(1, 6), " ") - 1)
If ActiveCell.EntireRow.Cells(1, 5) <> "" Then Label3.Caption = ActiveCell.EntireRow.Cells(1, 5)
If ActiveCell.EntireRow.Cells(1, 4) <> "" Then Label4.Caption = ActiveCell.EntireRow.Cells(1, 4)

End Sub

Open in new window

0
 

Author Comment

by:Omar Hernandez
ID: 41779295
Hey Saqib another inconvenience also pop

Fyi: if it is more helpful for you

add a code where, when those condition are met before applying new description to column "F" erase any words and apply the new informaiton to column "F"

more better understanding what i am saying please check the image below.
moving-from-zcompleted-to-hold.png
moving-from-zcompleted-to-hold-2.png
moving-from-zcompleted-to-hold-then-.png
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 41779300
First let me know if the last code worked as intended?
0
 

Author Comment

by:Omar Hernandez
ID: 41779302
all other inconvenience are solved the only part that will need a little tweaking is the part of the Auto Arrange button even if there is no number it starts on number 4
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 41779314
That is because there are hidden rows in the data which contain the number 3
0
 

Author Comment

by:Omar Hernandez
ID: 41779326
I see what your are saying,  when Auto Arrange is click can it exclude all other words that has numbers if it is not under the same name of row column "E" college

For example

on college is 5
on business is 2
on accounting is 4

If i click on auto arrange

on college it will start on 6
on business it will start on 3
on accounting it will start on 5
0
 

Author Comment

by:Omar Hernandez
ID: 41779330
this is what i meant, when Auto Arrange is click can it exclude all other words that has numbers if it is not under the same name of  column "E" college.
0
 
LVL 43

Accepted Solution

by:
Saqib Husain, Syed earned 500 total points
ID: 41779342
This is a new requirement. You would have close this question if this question has been correctly  answered. Then you can ask a new question.
0
 

Author Closing Comment

by:Omar Hernandez
ID: 41779344
Thanks again Saqib i really appreciate the help you provide.
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 41779349
Being pedantic, you should have selected the comment which contains the solution which correctly answers the question.

Anyways thanks for the appreciation. Glad to help.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
This article is the result of a quest to better understand Task Scheduler 2.0 and all the newer objects available in vbscript in this version over  the limited options we had scripting in Task Scheduler 1.0.  As I started my journey of knowledge I f…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question