Assign Data To A Separate Cell Based On Value Of Yet Another
I have a "memo of meeting" excel document used to capture notes during client meetings. In this document there's a cell for "purpose", "agenda", and "notes". The 'consultation type' cell is a drop-down populated by values set in Sheet2. The 'agenda' & 'notes" cells are then populated with information (also stored in Sheet2) based on what drop-down option was chosen in the 'purpose' cell. I'm currently making this happen with basic =IF() statements; however, the problem is that by doing it this way, the =IF() statement must reside in the actual cell which will end up showing the data.
This is undesirable as there may be additional notes, agenda items, etc. that I'll need to add during the meeting and as it's currently setup, I can only have either the pre-populated info OR the ad-hoc notes - not both. It seems a simple fix. Maybe put the =IF() statement in a cell off to the side but have it "assign" the value to 'agenda'/'notes' but that doesn't seem to work.
View Complete Thread with Replies
Related Forum Messages:
Data To Separate Worksheets Based On Cell
I have a spreadsheet of ~5000 rows of data that I would like to separate based on the product code column (11 product codes - 43,301,304,313,332,334,979,984,985,986,992). As it stands, I've been copying the sheets, then removing the data by filter, but doing this every week seems to be a waste of time.
Code To Assign Predefined Number In Separate Worksheet
Excel 2003: I need code that, when an "x" is entered in a cell in the "Activity" worksheet to assign a temporary unit #, it will look for the next available Temporary Unit # in the "Assign" worksheet. Then mark that unit # as "assigned" (by placing an "X" in the column next to it) and copy it to a cell in the "Activity" sheet.
I will be doing the same thing with assigning different types of PO numbers. I figure if I have the code for the Unit #, I can use the same logic for the other assignments, with some modifications, of course.
I've attached a sample workbook.
If I am not considering the most effective way to accomplish what I am trying to do here, I have no ego at all about someone suggesting a better solution.
Automatically Assign Predefined Unit # In Separate Worksheet
I have a worksheet that logs equipment activities. Equipment may already have a standard unit # assigned to it or it may need a temporary unit # assigned for tracking. In a separate worksheet is a column of predefined temp unit #'s that can be assigned and next it is a column to place an "X" once a unit # has been assigned.
I need to write logic that, when an "X" is entered in Column F (Assign a Unit #) of the Activities worksheet, the Unit # (Column G) will automatically select the next available Temp Unit # in the Assign worksheet...and mark that Unit # as no longer available. Quite frankly, this may be more easily done with VBA, but I am not experienced in that at all. I have attached a sample worksheet showing the format of the unit # to be assigned, etc.
Assign Range Name Based On Cell Values
In my workbook sheet 11 has some ranges that need to have names based on cell values in sheet2 (for purposes of data validation lists).
Range S28:S46 will assume the name of sheet2A11 & sheet2A3.
(example name period_1unit_1)
Range U28:U46 will assume the name of sheet2A11 & sheet2A4.
Range W28:W46 will assume the name of sheet2A11 & sheet2A5
Right now I am calling the code when something is entered into A11.
I have tried if statement and select case, but I ran into complications with both.
I have posted both codes with the questions I have concerning those codes.
Separate The Data From A Table Based On Certain Groups
I have a worksheet with 10000 records. For example, entire data in ColA-ColZ. In that, ColA-ColF - Personal Information; ColG-J Group1; ColK-N Group2; ColO-R Group3; ColS-U Group4; ColW-Z Group5. I this case, the data to be copied into another sheet as follows:
1) the personal data should be copied repeatedly.
2) Each Group data should be copied next to personal data.
3) The group's name is mentioned at the top of the datasheet.
I have attached a sample workbook for your kind reference.
Assign Names Dynamically Based On Cell Content
I do have a data set from A1:C8 as follows:-
Brand Name(A1)Sales Value(B1)Margin(C1)Levi's100002000Arrow150002500Allen Solly120001300Hanes80001000John Miller250004500Disney280003200Ray Ban180002100
The above brands are categorized as follows:-
Brand NameProposed CategoryLevi'sConsignmentArrowBrandAllen SollyBrandHanesBrandJohn MillerPrivate LabelDisneyBrandRay BanConcessionaire
I would like to put formula from D1:D8 in such a way so that the Proposed categories are extracted automatically through formulae. This will help in getting the contribution calculated from different categories.
Brand Name(A1)Sales Value(B1)Margin(C1)Category(Desired Result)(D1)Levi's100002000ConsignmentArrow150002500BrandAllen Solly120001300BrandHanes80001000BrandJohn Miller250004500Private LabelDisney280003200BrandRay Ban180002100Concessionaire
Assign Group Names Based On Cell Values
I have two tables below. First table contains the list of domain names (given just for example, actual list may contain several more such Domain names) with the group names assigned to them. Second table shows the criteria for assigning them the group names:
My concern is to automate this process using a VBA code. How can I search for the keyword given in Table 2 in the first column of Table 1 and assign the group names as it is assigned currently, considering the below conditions and criteria.
1) The correct group name should be assigned to the Domain name containing the keyword given as per criteria in Table 2
2) It is possible that the domain name will include more than one keywords given in Table 2. For example Cell number A7 contains both keywords NCG and EXC, in such cases the preferance should be given to EXC and we will assign the group name as EEC. And in Cell number A12 also contains both NCG and DMZ, again the preferance should be given to DMZ and we have to assign group name as ETIS.
That means we will give second preference to keyword NCG. If domain name contains none of the keywords except NCG as per given criteria then only we will assign grup name DOSS.
Transfer Data To Separate Tables Based Two Variables (date And Site)
I have a spreadsheet where raw data is entered ("RAW_DATA") for each month it is collected. There are 7 questions that are tallied and each of those responses are transfered to a separate data table for analysis (7 individual tabs within the spreadsheet). I'm currently manually data entering the values from the raw data tab to the other seven tabs.
I would like to have VBA code that could transfer the data from one month ("RAW_DATA") onto the other 7 tabs based on the date and facility identified in the raw data tab. I have not attempted the VBA since I do not know where to start with searching on two variables.
Separate Cell Change Based On Value In Cell
In my spreadsheet, certain transactions are labeled as "Fees" in Row G. I need any amounts in Row D to be negative if they are labeled as "Fees" in Row G.
I could simply find them manually and make them negative, but the logic needed in this question will help me with similar problems I am facing.
I am thinking it is probably some combination of the "IF" command.
Separate Data In Cell Into Columns
how to separate data such as this, into different columns?
85878; null;OMX;OM;2004-09-13 08:58:29.0;691.91;OMX Stock Index;693.01;688.67;691.91;15055;0.0;14.64;0.0;0.0;2004-09-10 00:00:00.0;0.0
Today this data is inserted into one cell, in one column, but in 50 000 rows (in 9 different sheets!). I would like to separe it into separe columns so I could run calculations on the data. Separating it manually would take me at least 1 year,
Using Data In Two Cells To ID Separate Sheet And Cell
I use Excel 2003. I need help building a macro, please, that will copy data to a specific page in another workbook based on two criteria. Here's the deal:
The data in Workbook A, Sheet 1, Cell A1 may contain the word ALPHA, BAKER, or CHARLIE. Cell A2 may contain the number 1, 2, or 3. Cell B1 contains the data I want to collect from various Workbook As and keep in a list to analyze.
Over in Workbook B, Sheets 1 through 3 are named ALPHA, BAKER, and CHARLIE. Rows A, B, and C are titled 1, 2, and 3.
How can I copy the data from Workbook A, identified as ALPHA 3, to it's place in Workbook B, Sheet ALPHA, Row C?
Furthermore, Workbook A is a one time form will be used many times. Thus, when I copy B1 to Workbook B, Sheet ALPHA, Row C, I need to paste the data in the first empty cell in the row.
Compare Data On 2 Separate Worksheets And Pull A Reference Cell
I have on inventory sheet that has all the data in each cell 2612 to be exact! That changes month to month with deletions.
The format is: Sheet 2
The master worksheet has about 5000 items and the (A and B) data are both on it with other data ranging from (A-Y). My question is how do I have a cell look up data and return that it exists or doesn’t exist on the inventory sheet?
My other problem I need to take that months inventory list and have it look at the master list and return the system number from the master list (B) next to the matching inventory number (C). Allowing me to cross match inventory to master each month and save inventory worksheet each month.
I know I can copy the column and past is as a value so I won’t lose the numbers as the master changes but getting the data onto that months inventory has been a pain.
Assign Dates Based On First Or Last Cells
1. Start Date (Col. C) - assign date to respective position based on first cell that contains value greater than 0 or "". eg. at first cell with 1 in it, looks up to row 4 and assigns date include in that cell in same column.
2. End Date (Col. D) - assigns date based on last cell with value greater than 0 or ""....
Assign Formula Values Based On Variables
I have three variables; Independent variables x & y, and dependent variable z. x & y can take the values 1,2,3 and can equal each other z can also take on values 1,2,3 but can never equal x or y. I tried using if/and statements to solve this (see below), but I would have to do it for each case and it exceeds Excels embedded function limit.
Assign Variable To Different Data Types
Putting the final touches on a project I have and the last element doesn't work 100%. the scenario: I have a function that I wrote based on the user's input of the desired column to perform the operation. As a method of error-trapping and ease of use, I set instructions for the code to activate:
1) if the user highlights multiple cells of the desired column
2) enters the letter of the column (up to "z", not case sensitive)
3) enters the number of the column
Dim ColumnUsed As Variant
' find number of columns selected
For MyColNum = 1 To Selection.Columns.Count
Cols = Cols + 1
'find number of rows selected
For MyRowNum = 1 To Selection.Rows.Count
Rows = Rows + 1
Creating Separate Reports In Separate Spreadsheets
I have a giant data sheet. I have to cherry pick certain data out of the list and send it to certain associates, in a new spreadsheet.
I want to do this automatically.
I can create the macro to select the data I want, and copy it over (values only), but I cannot find out how to do it in a new sheet with a new name that automatically gets generated with a unique filename (probably using the date).
Essentially, I want to copy my data spreadsheet (post-filter) into a new spreadsheet titled X mm-dd (where X is whatever I pick). I then want to delete several rows from it.
Ideally, the macro would do this (I will put a * next to things I can handle the code for, to save work):Filter Data *
Copy Data *
Create a New Spreadsheet named (Person's Name) mm-dd.xls
Paste Data (values, formats, column widths) to the new spreadsheet *
Delete Several Columns from the new spreadsheet *
Rename the sheet it's been pasted to
Re-filter data (new filter) *
Copy Data *
Paste Data (values, formats, column widths) to the same spreadsheet, only Sheet 2 *
Set the header of the spreadsheet with (Person's Name) and the date
Save the new spreadsheet
There will be as few as 1 sheet (in which case I would only want one worksheet in the new excel file), or as many as 4 sheets. I don't need a fancy way to do this, as it will only be done once a week, and I can just make the various cases required to do it even if it isn't pretty, but I can't figure out how to manipulate other files that haven't been created yet...
Lots Of Text Data, Need To Assign Unique Numeric Values
Here's my situation.
I will post a rudimentary example:
Account Name/Column A
Truman school, San Diego
Truman school, San Diego
Truman school, San francisco
Truman school, Atlanta
Truman school, Atlanta
In column B, I would like it to assign a unique numeric id based on the TEXT only.
So Truman school, San Diego gets a string of numbers: 1234
Truman school, san fran: 1235
Truman school, Atlanta: 1236
My spreadsheet is about 6,000 records with a great deal of the above situation going on. So school names are identical with different locations assigned. I am trying to import to a database and don't want a lot of duplicate records. That's why I'm trying to assign a numeric value.
Separate Data At Commas
I've imported a large document to excel. It contains 118 rows of information. My problem is that all the information is in column A. Every cell contains long sentences with information. The information is divided by a comma-sign (,). What i want to do is to seperate the information by columns instead of a commasign. So for example:
1 Div Date HomeTeam AwayTeam FTHG
Is there any smart way to do this??
Assign Value To Text Formatted Cell
I want to be able to "count" apples and oranges. Is there a way to record a particular text in a text formatted cell and count it. e.g. 10 cells, 3 say "apples", three say "oranges", 4 say "plums". I want excel to keep track of the three types of fruit when I change them and give me a running number of each.
Assign Value From Closed Workbook Cell
Is it possible to write a macro in Book1 to assign Public Varibles in Book1 to values located in cells in Book2 without first opening Book2. So lets say in Book2, sheet1, cell B2 contains the number 5. I want Public Variable "Number_value" in Book1 to equal the number 5.
Macro To Separate Data By Date
I am venturing into the unknown with this macro. I am attempting to take a sheet that has already been sorted by name.
It deals with payroll, and the sheet does include the last day of payroll in column F. The actual day worked is in column C.
The problem is that I sum all of the hours worked for each individual person, but I need to exclude hours that are not within the pay week.
Currently they are summed in a new row along with the hours from that week. Does anyone have any suggestions for a macro that could handle this task.
Separate Sheet Data Collection
I have a separate sheet(Coverage.jpg) that records some data which at this stage has to be entered manually.
The data comes from another sheet(officers.jpg), each row is 1 flight and the days are usually separated by a blank or grayed row.
I was wondering is there a formula that will collect the data automatically.
As you will see on Coverage.jpg it is broken down into Number of flights(per day), how many flights were covered by 2 or more officers and how many covered by 1 officer.. and then the graph generates off the data.
Is there a formula or something that will enter the per day data?
I have just added some false data to show you how some things get recorded.
Split Data Into Separate Spreadsheets
every month I import (from SAP) Local Authority staffing data for 200 schools into an Excel template. After a bit of tweaking I end up with a single spreadsheet showing formatted and adjusted data for all schools, with relevant headings separated by page breaks.
This is fine if for distributing a hard copy to schools, but I want to email it. I've seen macros that would allow data to be split onto separate tabs, but is there a way to break it down into 200 separate spreadsheets? I confess to not knowing any VBA, so be gentle with me
Alphabetize Separate Cells Of Data In Same Row
I have a worksheet with 6,500 rows of data. In each row, there are up to 6 cells containing a name in "Last, First" format. I need to alphabetize the data from these 6 cells so they go across the row in order left to right, alpha by last name.
Example of my data layout:
Column 1 Column 2 Column 3
Row 1 Jackson, Bob / Anderson, Lisa / Cardinal, Mike
Row 2 Tomlinson, Steve / Dodge, Sarah / White, Brian
I need them to be in this order:
Column 1 Column 2 Column 3
Row 1 Anderson, Lisa / Cardinal, Mike / Jackson, Bob
Row 2 Dodge, Sarah / Tomlinson, Steve / White, Brian
Is there a formula I can apply that will pull from only the portion of the data before the comma in each cell? Or do I need to separate out all of the names so the first and last names are in separate columns for this to work?
Find Data In Separate Worksheet
I would like to put together a macro that would compare a list of part numbers against a database, and recommend alternative vendors for the part. The actual VBA I think I can handle, my problem is with the formula, array or whatever is needed to return the results I am looking for.
I have attached a sample workbook to this message that contains two worksheets. The "Sample Database" is an example of the format of the database (in Excel format) that I will be looking against. This data may be a hundred columns wide, and thousands of rows long.
The "Vendor Reference" worksheet shows an example of the data that would be returned if the "perfect" formula were entered into the cells. (I'll explain what I mean by "perfect" in a moment.) It also has an area designated for testing formulas to see what is returned. It's blank, because none of my tests returned anything but errors.
You will notice the column headings on the "Sample Database" worksheet. Columns A and B will always contain the part number and product description. The remaining columns will contain vendor specific data, with perhaps 25 different vendors, and 3 columns per vendor. These columns would be "PV", (for Primary Vendor), the vendor number, (010299, for example), and the Vend Part#.
If there is an asterisk, "*", under the "PV" column for that vendor, that means they are the "Primary" vendor. The cost from that vendor is listed under each vendor number. There may be instances where 2 different vendors are listed as primary. If that's the case, the formula can simply return the FIRST one found.
Here's what the "perfect" formula would return: .....
Filtering Data Using Two Separate Columns
I have text in column A and text in column B. I would like to create column C and place the number 1 in each row whenever columns A and B contain the text I am looking for. I could then use C to filter all the 1's with ease (by way of macro or the autofilter). In my problem, column A contains the following text per cell:
Column B contains:
I need to filter based on column A having the letter "A", or column B having the word "MATT". Columns A and B do not have to contain both "A" and "MATT", respectively, in order for column C to have a 1.
Lookup Data From A Separate Sheet
I have a spreadsheet that has a resource table, project stage table and an approx 50 different project sheets. (The 50 sheets are duplicated layouts, just different project names)
Based on the data on the first two sheets I would like to populate the individual project sheet.
1.In the individual project sheet there are 5 stages in each quarter.
2.The project stage table sheet tells you want stage the individual project is in for the relevant quarters.
3.The resource table sheet tells you how many resources are required for that stage.
Based on this information, I would like to populate the individual project sheet with the information.
E.g. If the project is in the 1st stage, it would then go to the resource table and take number of resources allocated for that stage and populate the “relevant” field in the individual project sheet with the correct value.
I've attached the spreadsheet to hopefully better illustrate this.
Adding Data To A Separate Worksheet
I have a userform which when you enter data and hit submit, inserts data into a seperate sheet in the same file. Code below
Private Sub CommandButton1_Click()
UserForm1.tbJobNo.Value = _
Sheets("Purchase Order"). Range("I4")
UserForm1.tbJobTitle.Value = _
UserForm1.tbOrderNo.Value = _
UserForm1.cbdirector.Value = _
Instead of placing the data into another worksheet i would like to put the data into a closed xls file named Purchase Order Database.xls.
How can adjust the code for it to do this?
Assign Name To Range Using Variables And Cell Values
For example, I have the numerical value "400" in R1C2 and that value would be used in the name "D400" which is to be assigned to R1C1:R5C2.
The code I have is:
Range("R" & DRow & "C1:R" & DRow + 4 & "C2") = "D" & Cells(DRow, 2).Value
but is throwing up the error:
"Run-time error '1004':
Method 'Range' of object '_Global' failed
DRow increases dependant on other variable data.
Also, am I right to be using R1C1 instead of A1, or can the same be achieved using A1 references? If so, I think I may not be able to see the wood for the trees.
Assign Specific Cell Value Of Worksheet To A Label
I am struggling with working with specific cells from specific sheets. e.g.
I want to make a label display teh value of a specific cell.
(i is the row number of the cell i'm interested in)
'now make labellaptime.caption = the cell (i-1, 3) of sheet1(jules)
'LabelLaptime.Caption = i - 1 'works no problem
'LabelLaptime.Caption = Application.Worksheets(Sheet1).Cells(i, 3) 'laptime
'LabelLaptime.Caption = Application.Worksheets(1).Range("i-1,3").Value
'LabelLaptime.Caption = Application.WorksheetFunction.VLookup(
'LabelLaptime.Caption = Range("c3") 'works no problem
'LabelLaptime.Caption = ThisWorkbook.Worksheets.("sheet1").range("c1").value
I've based all this on the book i'm trying to learn from but it doesn't work and (obviously) i don't know why...
(plus any links to info on how to work with specific cells on specific sheets e.g making a variable = to the value of a cell(x,x) of sheet 3)
Assign Multiple Cell's Values To A Variable
Need exact VBA code syntax to assign a workbook (to be closed) sheet's cells J4 to J72 values to a variable called "ColJValues" to be assigned to another sheet (to be opened later in the macro). The values are all dates. Once the other workbook is opened later in the macro, need the exact syntax to assign the value in the above variable, "ColJValues", to it's cells J4 to J72.
Assign External Cell Reference To Variable In VBA?
I'd like to assign a value located in a cell in a workbook to a variable in a VBA program in another workbook. I do NOT want to open the workbook that contains the cell with the value. I can't get the hang of referencing an external cell reference. Let's say there's a value in a cell named "nbr" in a workbook named "tst.xls" located in a path "c: est" that I want to assign to a variable "tstnbr" in a VBA program, what is the best way to code that?
Matching Data On Two Separate Sheets And Copying From One To Another
If the name in Column F of "Sheet1" is found in "DataPEs" in Column B, then copy the block of 6 cells of data below it in column Q to column D of "Sheet1" in their relative rows. Additionally, if column Q has data then copy it, if not then copy the data only in column M. Finally, the number of matching names will vary in Sheet1 but will stay mostly the same in the DataPEs sheet. I've highlighted one block of data in green as an example.
Highlight Duplicates Within Separate Groups Of Data
I have just looked through most of the postings I could find on the board regarding VBA to identify duplicates. Virtually all of these use the entire column when checking for duplicates.
I am after code which will identify duplicates in column A within a contiguous range of data.
For example there is a heading in column B and below this photo details will be entered and in the next column the photo number is entered.
Finally a number (for sorting) is entered in column A. The photos will be numbered 1 to whatever. So I need code which will highlight duplicates in that contiguous range of data.
Then there is one or two blank rows before another batch of photo details are entered. This means the same sorting numbers are used and are separated by a blank row or rows.
Save UserForm Data Into Separate Workbook
I have a form which creates a budget based on user input. I want to save that user input in a separate workbook. My goal is to reduce the file size. I have several modules which perform evaluations/ calculations, and then format the output in a worksheet, but the size is pretty large 450KB.
I was thinking that I could set the control source, to different cells on the worksheet, and then just copy the worksheet to a new workbook, and save the data by itself. Then if I wanted to change the data for a given budget, I would copy the sheet back into the workbook that contains the modules, and load the form again. Is this a good solution? Is there a better way? Please let me know if I can provide more information.
Extract Data By Type To Separate Workbooks
I have created a workbook for a co-worker. The way it works is data comes from an outside source with customer names in Column A and their Account Reps in Column H. This data is pasted into a template that I created with a very simple macro recording that filters on each Account Rep and is copied and pasted each into a different workbook. Then I had to go through each workbook (because of the info being sensitive) and create a macro that deletes the unwanted data because when the data is pasted it transfers all of the data and you can unfilter to see the full sheet.
I know there is a better way to extract data on each change in column H into a new workbook. Does anyone know how to do that? Another issue is the original data is not very clean so there are blank rows in the list. For Example:
CustomerTechnology SegmentOpportunity Dollars ($)Opportunity StatusAction Item(s)(ST) or (LT)Due dateAcct RepCustomer 1Action 1ST3/30/2008ACCustomer 2Technology 1Action 2LTTBDACCustomer 3Technology 2$10,000FindAction 3LTTBDACCustomer 4Technology 3FindAction 4LTTBDBHCustomer 5Technology 4FindAction 5LT1/31/2008BHCustomer 6$30,000Action 6LTTBDBHCustomer 7Action 7LTTBDMJCustomer 8Technology 5$10,000QualifiedAction 8ST3/1/2008MJCustomer 9Technology 6QualifiedAction 9ST2/28/2008CGCGCustomer 10Technology 7$18,000FindAction 10ST3/1/2008CGCustomer 11Technology 8$10,000QualifiedAction 11ST3/30/2008BHCustomer 12Technology 9FindAction 12LTTBDACCustomer 13FindAction 13LT3/15/2008AC
Convert The Each Item [data] Above Into Separate Columns
I have a 45 page spreadsheet with over 3500 contacts and the data is currently listed in individual cells as seen below:
Director of Business Travel Sales
1200 Market St.
Philadelphia, PA 19107
Phone (215) 555-1234
Fax (215) 555-4321
I want to convert the each item [data] above into separate columns so I can then save it as a CSV file and then export th data into an email list; but I have no idea how do to this.
Separate Data Groups To Seperate Worksheets
I have a data sheet of 190,000 lines. It is a telecommunications bill with has approx 15 columns.
I need to separate the spreed sheet into the respective "call types" and put this data onto separate tabs, at the moment I do it all manually with Excel 2007.
Is there a way of automating this separation of data
Converting Pdf Cut And Pasted Data Into Separate Cells
I have rxd a pdf file that I need to manipulate I have copied the data into excel and now need it in individual cells:? The data looks like this: 02392950067 19/12/2008 14:33:35 02392950053 Portsmouth 1.9 £0.03. this is:
phone number calling | date called | time called | number called | duration in minutes | cost of call. If you're out there I'd be more than happy to hear from you. the cells to cut the data into will be formatted to take the data in the correct form. 02392950067 19/12/2008 14:33:35 02392950053 Portsmouth 1.9 £0.03
phone number calling | date called | time called | number called | duration in minutes | cost of call.
Compare Data In Separate Workbook Or Worksheet
Im working with a huge amount of data in BOOK1.xls and once or twice a week I received an update of the list.
1. I need to compare and find out from the new updated worksheet if there is a new revision, and if there are new documents added to the list. I have tried Vlookup..but it didnt work for me. Ex. Doc1 has revision 1, 2 in my BOOK1 that I am working on. Note that there is a repetition of the DocName, Doc Number except for the revision.
Assign Password To A Hidden Sheet, Only 1 Cell Populated
This is my input for password prompt:
Dim wSheet As Worksheet
On Error GoTo ErrHandler
Currently, my excel is protected with a password "PSWD" when users open the file. In my vba script, I have a function that can unprotect my excel without any password input box to the users. This method is to unprotect the file and allow users to do any formating columns and rows tasks, such as add or delete cells. After users finish their job, the file will be protected back. The function is such as below:
Dim wSheet As Worksheet
For Each wSheet In Worksheets
Application.ScreenUpdating = False
If wSheet.ProtectContents = True Then
My questions are:
1. How I can create a hidden sheet that has one cell populated only?
2. How can I assign the password that the user enters at the "TextBox1" (first code) to a cell of of the hidden sheet? Do I have to modify the first code?
3. For the second code, how am I going to assign the value to at the wSheet.Unprotect/Protect Password:="..." with whatever the user has previously chosen as a password that refers at the hidden sheet?
VBA Slow To Assign A Null String To A Cell - On One Computer Only
I have a VBA program which is running very slowly on one of my computers, but none of the others.
Here's a piece of code which illustrates the problem, which is that assigning a null string to a cell is very slow.
Public Sub test()
Dim objSh As Worksheet
Dim I As Integer
Set objSh = Worksheets("Sheet1")
For I = 1 To 1000
objSh.Cells(1, 1) = ""
For I = 1 To 1000
objSh.Cells(1, 1) = " "
If I change this to assign a space instead it is very fast (about 1,000 times faster).
This slow machine is not normally slow; an ACER Aspire 9410Z with 2GB RAM, running Vista Ultimate.
Other machines run this code OK on a mix of Windows XP, 2000 and Vista Business. with Excel 2003, 2000 and 2007.
Ultimate seems to be the only unique factor of the machine where it runs slowly.