Using IPhreeqc in Excel

djb14128

New Member
Joined
Nov 14, 2019
Messages
27
I can't get excel to do what I want after creating this VBA script:

Sub sbCopyRangeToAnotherSheet()


LastColumn = ActiveSheet.UsedRange.Columns(ActiveSheet.UsedRange.Columns.Count).Columns

For n = 63 To 63
For i = n To n
Worksheets("Data").Activate
Worksheets("Data").Range(Cells(i, 45), Cells(i + 6, 54)).Copy
Worksheets("Data").Activate
Worksheets("Data").Range(Cells(63, 64), Cells(69, 74)).PasteSpecial xlPasteAll
RunPhreeqc
Worksheets("Output").Activate
Worksheets("Output").Range(Cells(2, 20), Cells(8, 29)).Copy
Worksheets("Data").Activate
Worksheets("Data").Range(Cells(i + 10, 45), Cells(i + 16, 54)).PasteSpecial xlPasteAll


Next i
'Application.ScreenUpdating = True


Next n
For i = n + 20 To 103
Worksheets("Data").Activate
Worksheets("Data").Range(Cells(i, 45), Cells(i + 6, 54)).Copy
Worksheets("Data").Activate
Worksheets("Data").Range(Cells(63, 64), Cells(69, 74)).PasteSpecial xlPasteAll
RunPhreeqc
Worksheets("Output").Activate
Worksheets("Output").Range(Cells(2, 20), Cells(8, 29)).Copy
Worksheets("Data").Activate
Worksheets("Data").Range(Cells(i + 10, 45), Cells(i + 16, 54)).PasteSpecial xlPasteAll


Next i
End Sub


What I am trying to do here is copy data from 'Data' sheet and paste it to the same 'Data' sheet. Then I run IPhreeqc, and copy and paste the output from the 'Output' sheet back into the 'Data' sheet. The problem here is that VBA is not highlighting the range of cells I want, it just highlights the range of cells a row down. Many thanks in advance.
 
Last edited:

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
I want VBA/excel to do this step over and over until I want it to stop. The number of cells between the the first table is the same as the next table down. The table have the same range as the next table down. There are multiple tables that I have to fill in after that, that's why I want excel/VBA to carry out the loop multiple times until I want it to stop.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,875
Members
452,363
Latest member
merico17

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