Sheet1.Range(“b13”) = Sheet2.Range(“l” & i)ĬhDir “C:\Users\91971\Desktop\Salary Slip”ĪctiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _ Set rng = Sheet2.Range(“A1:A” & Sheet2.Cells(Rows.Count, “A”).End(xlUp).Row)įor i = 2 To Sheet2.Cells(Rows.Count, “A”).End(xlUp).Row You can try this llected from another website. Is this possible or will it be too big as well? Thank you in advance for your help. I was hoping that I could add a looping code to the first original macro that takes info from row 1 of spreadsheet1 and pastes it into the proper cells on spreadsheet2 (report spreadsheet) and then prints it. I have read about looping, but was not sure how to code that. When I tried to run the macro, it said it was too big. I actually spent the afternoon recording a macro where I went through and did this individually with each row (100 times). I have created a recorded macro that will take each cell from the 1st row and place it in the proper place on the “report spreadsheet” and then print the spreadsheet. I will need to do this for each row of data – thus, I will need to do this 100x. I am able to do this with my current level of knowledge. This spreadsheet is designed to look like a report. I would like to take data from each row – one row at a time and copy into another spreadsheet. I have a spreadsheet that contains 100 rows. Do you have a code for the following scenario? Unfortunately, it does not cover what I am trying to do. Characters(J, Len(myStr)).Font.ColorIndex = 3 MyStr = myRg.Range(“B1”).Offset(I, 0).Value MsgBox “the selected range can only contain two columns ” (“please select the data range:”, “Selection Required”, myTxt,, ,, , 8) I am not able to run this code it giving me an error of “Variable required. When I double click each of these 7 cells – I would like to see the following:Ĭell 1: Initial (White) When double clicked (Red)Ĭell 2: Initial (White) When double clicked (Yellow)Ĭell 3: Initial (White) When double clicked (Grey)Ĭell 4: Initial (White) When double clicked (Green)Ĭell 5: Initial (White) When double clicked (Fluorescent Green)Ĭell N/A: Initial (White) When double clicked (stay White)Īny help would be appreciated in this regard. All cells are with “No Fill – White” initially. So each respondent will select their option out of these six options, which I am going to show in separate colors in Agenda Sheet (Excel file) where I need to run this requested code/script.Īgainst, each question I have 7 cells – The first sex cells for the options and the 7th cell for the consensus choice. Lets say, I have 5 respondents for each survey. This imported survey data has 6 (Six) options (1, 2, 3, 4, 5, and N/A) for each survey question. I have a survey form send to various survey respondents which is now completed and I have already exported it as an Excel File. MsgBox "Your Pivot Table is now updated."Ĭould somebody help me create a macro script for the following routine. Pivot_Sheet.PivotTables(PivotName).RefreshTable PivotCaches.Create(SourceType:=xlDatabase, SourceData:=NewRange) 'Change Pivot Table Data Source Range Address NewRange = Data_Sheet.Name & "!" & DataRange.Address(ReferenceStyle:=xlR1C1) Set DataRange = Data_Sheet.Range(StartPoint, Cells(DownCell, LastCol)) LastCol = StartPoint.End(xlToRight).Column Set Pivot_Sheet = ThisWorkbook.Worksheets("Pivot3") Thanks to for showing how to read a registry key and finding the registry key with the folder path.Set Data_Sheet = ThisWorkbook.Worksheets("PivotTableData3") Call it like this: Debug.Print GetCurrentUserDownloadsPath or Debug.Print GetCurrentUserDownloadsPath. This turns it into a function and returns the actual path. I didn't know what to do with it so I created the function below. The posted answer was returning "%USERPROFILE%\Downloads". GetDownloadsPath = Environ$("USERPROFILE") & "\Downloads" This is from a comment by As others have mentioned it will provide the wrong folder path if the user has changed the default "Downloads" location - but it's simple.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |