i have excel file which i required comment or suggestion button(VBA).(i have attached file for reference)

shiva786

New Member
Joined
Feb 5, 2014
Messages
29
Please download my reference sheet and give some VBA codes according to that.
my requirement is "i have one sheet which i have protected by my password, if i send to my freind that file, he can only read the content , suppose if he has any sugestion he will right in the box which i pasted in excel file, so plz anyone put some VBA code for that or u can answer in this forum, plz..

https://www.dropbox.com/s/6fe0g8evnii4cjq/reference sheet.xlsm
 
Last edited:

Some videos you may like

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.

erik.van.geit

MrExcel MVP
Joined
Feb 1, 2003
Messages
17,832
Hi,

I saw the workbook, but this thread would be worthless without good information here.

I think your question is:
Code:
How can we put the contents of two textboxes in two columns (on another sheet) in the next available row?

Is it?

kind regards,
Erik
 

shiva786

New Member
Joined
Feb 5, 2014
Messages
29
yes correct,, if someone has some sugestion they will enetr their sugestion on first page, once they will submit it will go to 2nd sheet(No matter how man coulmns/rows it will consume
 

erik.van.geit

MrExcel MVP
Joined
Feb 1, 2003
Messages
17,832
Hi

This code works for me.
You can put it within the sheetmodule (sheet where controls are located)
Code:
Private Sub CommandButton1_Click()
Dim NextRow As Long
Dim TB1 As msforms.TextBox
Dim TB2 As msforms.TextBox

    With ActiveSheet
    Set TB1 = .TextBox1
    Set TB2 = .TextBox2
    End With
    
    If TB1.Text = "" Or TB2.Text = "" Then
    MsgBox "Please fill in both textboxes", vbExclamation, "Empty textbox"
    Exit Sub
    End If
    
    With Sheets("Coment Storage location")
    NextRow = .Range("A" & Rows.Count).End(xlUp).Row + 1
    .Range("A" & NextRow) = TB1: TB1.Text = ""
    .Range("B" & NextRow) = TB2: TB2.Text = ""
    .Range("C" & NextRow) = Now
    End With
   
    MsgBox "Your comments are stored on next sheet", vbInformation, "COMMENTS"
    
End Sub
Note that your textboxes are not numbered in the correct order.
You could change the code, but I would strongly advise to switch the textboxes or their names; this will avoid confusion.

best regards,
Erik
 

shiva786

New Member
Joined
Feb 5, 2014
Messages
29
Hi

This code works for me.
You can put it within the sheetmodule (sheet where controls are located)
Code:
Private Sub CommandButton1_Click()
Dim NextRow As Long
Dim TB1 As msforms.TextBox
Dim TB2 As msforms.TextBox

    With ActiveSheet
    Set TB1 = .TextBox1
    Set TB2 = .TextBox2
    End With
    
    If TB1.Text = "" Or TB2.Text = "" Then
    MsgBox "Please fill in both textboxes", vbExclamation, "Empty textbox"
    Exit Sub
    End If
    
    With Sheets("Coment Storage location")
    NextRow = .Range("A" & Rows.Count).End(xlUp).Row + 1
    .Range("A" & NextRow) = TB1: TB1.Text = ""
    .Range("B" & NextRow) = TB2: TB2.Text = ""
    .Range("C" & NextRow) = Now
    End With
   
    MsgBox "Your comments are stored on next sheet", vbInformation, "COMMENTS"
    
End Sub
Note that your textboxes are not numbered in the correct order.
You could change the code, but I would strongly advise to switch the textboxes or their names; this will avoid confusion.

best regards,
Erik

Thank-You.jpg
 

Watch MrExcel Video

Forum statistics

Threads
1,123,085
Messages
5,599,650
Members
414,325
Latest member
kfg1287

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top