user input with text box?

fahimip

New Member
Joined
Sep 27, 2006
Messages
35
Hi guys

I am wanting to write code for a spreadsheet in the following layout
the columns are week numbers (1-52)
and the rows are names

WEEK 1 2 3 4 5 6 7 8 9 10 11 12
NAME
paul 32 7 7
tim 4
tommy 5 5 5
john 1 5 7 7 69 5
ivan 54 5 36
george 2 20 5
mario 3 5 4
mark 5 2 88
tom 66 1 3
graham 5 5
chris 56 8
elaine 8 3
matt




The code i need to write will ask the user which week he/she is inputting into and then only input data into that particular column. the data will be derived from another worksheet.


the thing that confuses me is how to program vba so that it will input in the right column depending on the week no. chosen


Thanks for your help
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
hi fahimip
will this do
Code:
Sub test()
Dim WeekNo As Integer
Dim ColumnNo As Integer
Worksheets("Sheet1").Activate
WeekNo = Application.InputBox( _
    prompt:="Input Week Number data to be entered (1-52)", _
    Title:="Week Number", Type:=1)

ColumnNo = WeekNo + 1
 
    Worksheets("sheet1").Cells(2, ColumnNo) = "some data"
    Worksheets("sheet1").Cells(3, ColumnNo) = "some data2"

End Sub
 
Upvote 0

Forum statistics

Threads
1,215,044
Messages
6,122,827
Members
449,096
Latest member
Erald

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
Back
Top